{"id":28702860,"url":"https://github.com/epiforecasts/bpmodels","last_synced_at":"2025-06-14T13:05:37.089Z","repository":{"id":65354562,"uuid":"164804511","full_name":"epiforecasts/bpmodels","owner":"epiforecasts","description":"[RETIRED. Use the epichains package instead]. Methods for simulating and analysing the sizes and lengths of chains from branching process models","archived":false,"fork":false,"pushed_at":"2025-02-05T12:25:57.000Z","size":5687,"stargazers_count":7,"open_issues_count":6,"forks_count":7,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-08T03:44:03.518Z","etag":null,"topics":["branching-process","epidemic-dynamics","epidemic-modelling","epidemic-simulations","epidemiology","epiverse","outbreak-simulator","r","r-package","transmission-chain","transmission-chain-reconstruction"],"latest_commit_sha":null,"homepage":"https://epiforecasts.io/bpmodels/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/epiforecasts.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-01-09T06:42:06.000Z","updated_at":"2025-03-19T08:25:35.000Z","dependencies_parsed_at":"2024-06-21T03:58:45.861Z","dependency_job_id":"df107243-2265-41a5-b4ea-a6d96d4fa876","html_url":"https://github.com/epiforecasts/bpmodels","commit_stats":null,"previous_names":["sbfnk/bpmodels","epiforecasts/bpmodels"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/epiforecasts/bpmodels","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epiforecasts%2Fbpmodels","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epiforecasts%2Fbpmodels/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epiforecasts%2Fbpmodels/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epiforecasts%2Fbpmodels/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/epiforecasts","download_url":"https://codeload.github.com/epiforecasts/bpmodels/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/epiforecasts%2Fbpmodels/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259820811,"owners_count":22916548,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["branching-process","epidemic-dynamics","epidemic-modelling","epidemic-simulations","epidemiology","epiverse","outbreak-simulator","r","r-package","transmission-chain","transmission-chain-reconstruction"],"created_at":"2025-06-14T13:05:36.208Z","updated_at":"2025-06-14T13:05:37.076Z","avatar_url":"https://github.com/epiforecasts.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\nbibliography: vignettes/references.json\nlink-citations: true\n---\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = file.path(\"man\", \"figures\", \"README-\"),\n  out.width = \"100%\"\n)\n```\n\n# _bpmodels_: Methods for simulating and analysing the size and length of transmission chains from branching process models\n\n\u003c!-- badges: start --\u003e\n[![Lifecycle: retired](https://img.shields.io/badge/lifecycle-retired-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#retired)\n![GitHub R package version](https://img.shields.io/github/r-package/v/epiforecasts/bpmodels)\n[![R-CMD-check](https://github.com/epiforecasts/bpmodels/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/epiforecasts/bpmodels/actions/workflows/R-CMD-check.yaml)\n[![codecov](https://codecov.io/github/epiforecasts/bpmodels/branch/main/graph/badge.svg)](https://app.codecov.io/github/epiforecasts/bpmodels) \n![GitHub contributors](https://img.shields.io/github/contributors/epiforecasts/bpmodels)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/license/MIT/)\n\u003c!-- badges: end --\u003e\n\n\n## WARNING\n\n\u003e `{bpmodels}` is now *retired and will no longer be maintained*. We recommend using [`{epichains}`](https://github.com/epiverse-trace/epichains) instead. If you need help converting your code to use `{epichains}`, please [open a discussion on epichains](https://github.com/epiverse-trace/epichains/discussions).\n\n```{r setup, include=FALSE}\nknitr::opts_chunk$set(echo = TRUE)\n```\n\n_bpmodels_ is an R package to simulate and analyse the size and length of \nbranching processes with a given offspring distribution. These models are often \nused in infectious disease epidemiology, where the chains represent chains of\ntransmission, and the offspring distribution represents the distribution of \nsecondary infections caused by an infected individual.\n\n# Installation\n\nThe latest development version of the _bpmodels_ package can be installed via\n\n```{r eval=FALSE}\n# check whether {pak} is installed\nif (!require(\"pak\")) install.packages(\"pak\")\npak::pkg_install(\"epiforecasts/bpmodels\")\n```\n\nTo load the package, use\n\n```{r eval=TRUE}\nlibrary(\"bpmodels\")\n```\n\n# Core functionality\n\n_bpmodels_ provides three main functions: \n\n`chain_ll()`: calculates the likelihoods of observing a vector of chains \n  of given sizes or lengths.\n\nHere is a quick example of estimating the loglikelihood of an observed chain:\n```{r}\n# example of observed chain sizes\nchain_sizes \u003c- c(1, 2, 3, 4) \n# estimate loglikelihood of the observed chain sizes\nchain_ll_eg \u003c- chain_ll(x = chain_sizes, offspring = \"pois\", \n                        stat = \"size\", lambda = 0.5)\nchain_ll_eg\n```\n\n\n`chain_sim()`: simulates transmission chains until all chains stop producing\n  offspring.\n\nBelow is a quick example where we simulate the chain sizes of $5$ chains with \na poisson offspring with mean, $\\text{lambda} = 0.5$:\n```{r}\nset.seed(123)\n\nchain_sim_eg \u003c- chain_sim(n = 5, offspring = \"pois\", stat = \"size\", \n                          lambda = 0.5, tree = TRUE)\n\nhead(chain_sim_eg)\n```\n\n`chain_sim_susc()`: simulates transmission chains from a specified population\n  size with pre-existing immunity until the susceptible pool runs out.\n  \nBelow is a quick example where we simulate chains with a poisson \noffspring with mean, $\\text{lambda} = 0.5$, and serial interval of $3$:\n```{r}\nset.seed(1234)\n\nchain_sim_susc_eg \u003c- chain_sim_susc(pop = 1000, offspring = \"pois\",\n                                    mn_offspring = 0.5,\n                                    serial = function(x) {3}\n                                    )\n\nhead(chain_sim_susc_eg)\n```\n\nSee the [\"Get started vignette\"](https://epiforecasts.github.io/bpmodels/articles/bpmodels.html) for a detailed illustration of \neach function.\n\n## Package vignettes\n\nSpecific use cases of _bpmodels_ can be found in \nthe [online documentation as package vignettes](https://epiforecasts.github.io/bpmodels/), under \"Articles\".\n\n## Reporting bugs \n\nTo report a bug please open an [issue](https://github.com/epiforecasts/bpmodels/issues/new/choose).\n\n## Contribute\n\nWe welcome contributions to enhance the package's functionalities. If you \nwish to do so, please follow the [package contributing guide](https://github.com/epiforecasts/bpmodels/blob/main/.github/CONTRIBUTING.md).\n\n## Code of conduct\n\nPlease note that the _bpmodels_ project is released with a [Contributor Code of Conduct](https://github.com/epiforecasts/.github/blob/main/CODE_OF_CONDUCT.md). \nBy contributing to this project, you agree to abide by its terms.\n\n## Citing this package\n\n```{r message=FALSE, warning=FALSE}\ncitation(\"bpmodels\")\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fepiforecasts%2Fbpmodels","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fepiforecasts%2Fbpmodels","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fepiforecasts%2Fbpmodels/lists"}