-
+
@@ -63,7 +63,7 @@
diff --git a/search.json b/search.json
index 7617a4c..b31ea7f 100644
--- a/search.json
+++ b/search.json
@@ -1 +1 @@
-[{"path":"https://epiverse-trace.github.io/bpmodels/CONTRIBUTING.html","id":null,"dir":"","previous_headings":"","what":"Contributing to bpmodels","title":"Contributing to bpmodels","text":"outlines propose change bpmodels.","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/CONTRIBUTING.html","id":"making-changes","dir":"","previous_headings":"","what":"Making changes","title":"Contributing to bpmodels","text":"want make change, ’s good idea first file issue make sure someone team agrees ’s needed. ’ve found bug, please file issue illustrates bug minimal reprex (also help write unit test, needed). See bug report template. feature request see feature request.","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/CONTRIBUTING.html","id":"pull-request-process","dir":"","previous_headings":"Making changes","what":"Pull request process","title":"Contributing to bpmodels","text":"See pull request template Fork package clone onto computer. haven’t done , recommend using usethis::create_from_github(\"epiverse-trace/bpmodels\", fork = TRUE). Install development dependencies devtools::install_dev_deps(), make sure package passes R CMD check running devtools::check(). R CMD check doesn’t pass cleanly, ’s good idea ask help continuing. Create Git branch pull request (PR). recommend using usethis::pr_init(\"brief-description--change\"). Make changes, commit git, create PR running usethis::pr_push(), following prompts browser. title PR briefly describe change. body PR contain Fixes #issue-number. user-facing changes, add bullet top NEWS.md (.e. just first header). Follow style described https://style.tidyverse.org/news.html.","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/CONTRIBUTING.html","id":"code-style","dir":"","previous_headings":"Making changes","what":"Code style","title":"Contributing to bpmodels","text":"New code follow tidyverse style guide. can use styler package apply styles, please don’t restyle code nothing PR. use roxygen2, Markdown syntax, documentation. use testthat unit tests. Contributions test cases included easier accept.","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/CONTRIBUTING.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Contributing to bpmodels","text":"Please note bpmodels released Contributor Code Conduct. contributing project agree abide terms.","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2023 bpmodels authors Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/articles/bpmodels.html","id":"note","dir":"Articles","previous_headings":"","what":"Note","title":"Analysing infectious disease transmission chains with bpmodels","text":"bpmodels now retired longer maintained. recommend using {epichains} instead. need help converting code use {epichains}, please open discussion epichains. bpmodels provides methods analyse simulate size length branching processes arbitrary offspring distribution. can used, example, analyse distribution chain sizes length infectious disease outbreaks, discussed Farrington, Kanaan, Gay (2003) Blumberg Lloyd-Smith (2013).","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/articles/bpmodels.html","id":"quick-start","dir":"Articles","previous_headings":"","what":"Quick start","title":"Analysing infectious disease transmission chains with bpmodels","text":"","code":"library(\"bpmodels\")"},{"path":"https://epiverse-trace.github.io/bpmodels/articles/bpmodels.html","id":"chain_ll-calculate-log-likelihoods","dir":"Articles","previous_headings":"Quick start","what":"chain_ll(): calculate log-likelihoods","title":"Analysing infectious disease transmission chains with bpmodels","text":"chain_ll() function calculates log-likelihood distribution chain sizes lengths given offspring distribution associated parameters. example, observed distribution chains sizes \\(1, 1, 4, 7\\), can calculate log-likelihood observed chain assuming offspring per generation Poisson distributed mean number (can interpreted reproduction number, \\(R_0\\)) \\(0.5\\). , run first argument chain_ll() chain size (length, number generations chain lasted) distribution analyse. second argument, offspring, specifies offspring distribution. specified string name function used generate random offspring. can probability distribution implemented R, , one corresponding function generating random numbers beginning letter r. case example , since random Poisson numbers generated R using function called rpois(), string pass offspring argument \"pois\". third argument, stat, determines whether analyse chain sizes (\"size\", default argument specified) lengths (\"length\"). Lastly, named arguments recognised chain_ll() interpreted parameters corresponding probability distribution, lambda = 0.5 mean Poisson distribution (see R help page Poisson distribution information).","code":"chain_sizes <- c(1, 1, 4, 7) # example of observed chain sizes chain_ll(x = chain_sizes, offspring = \"pois\", stat = \"size\", lambda = 0.5) #> [1] -8.607196"},{"path":"https://epiverse-trace.github.io/bpmodels/articles/bpmodels.html","id":"imperfect-observations","dir":"Articles","previous_headings":"Quick start > chain_ll(): calculate log-likelihoods","what":"Imperfect observations","title":"Analysing infectious disease transmission chains with bpmodels","text":"default, chain_ll() assumes perfect observation, obs_prob = 1 (See ?chain_ll), meaning transmission events observed recorded data. observations imperfect, chain_ll() provides argument, obs_prob, specifying probability observation. probability used determine likelihood observing specified chain sizes lengths. case imperfect observation, true chain sizes lengths simulated repeatedly (number times given nsim_obs argument), likelihood calculated simulations. example, probability observing case obs_prob = 0.30, use returns 10 likelihood values (nsim_obs = 10), can averaged come overall likelihood estimate. find usage chain_ll() function, can run ?chain_ll access R help file.","code":"chain_sizes <- c(1, 1, 4, 7) # example of observed chain sizes ll <- chain_ll(chain_sizes, \"pois\", \"size\", obs_prob = 0.3, lambda = 0.5, nsim_obs = 10) ll #> [1] -20.47284 -22.52364 -26.77325 -24.33340 -21.86479 -22.11361 -32.01951 #> [8] -19.77477 -22.90776 -27.59180"},{"path":"https://epiverse-trace.github.io/bpmodels/articles/bpmodels.html","id":"how-chain_ll-works","dir":"Articles","previous_headings":"Quick start > chain_ll(): calculate log-likelihoods","what":"How chain_ll() works","title":"Analysing infectious disease transmission chains with bpmodels","text":"probability distribution chain sizes lengths analytical solution, used. chain_ll() currently supports Poisson negative binomial size distribution Poisson geometric length distribution. analytical solution exist, simulations used approximate probability distributions (using linear approximation cumulative distribution unobserved sizes/lengths). case, extra argument nsim_offspring must passed chain_ll() specify number simulations used approximation. example, get offspring drawn binomial distribution probability prob = 0.5, run","code":"set.seed(12) chain_sizes <- c(1, 1, 4, 7) # example of observed chain sizes chain_ll(chain_sizes, \"binom\", \"size\", size = 1, prob = 0.5, nsim_offspring = 100) #> [1] -8.496803"},{"path":"https://epiverse-trace.github.io/bpmodels/articles/bpmodels.html","id":"chain_sim-simulate-transmission-chains-with-branching-processes","dir":"Articles","previous_headings":"Quick start","what":"chain_sim(): simulate transmission chains with branching processes","title":"Analysing infectious disease transmission chains with bpmodels","text":"simulate branching process, use chain_sim() function. function follows syntax chain_ll(). Note chain_sim() stochastic, seed needs set ensure results can reproduced. , simulating \\(5\\) chains, assuming offspring generated using Poisson distribution mean, lambda = 0.5. default, chain_sim() returns vector chain sizes/lengths. instead want return tree infectees infectors, need specify function serial interval set tree = TRUE (see next section).","code":"set.seed(12) chain_sim(n = 5, offspring = \"pois\", stat = \"size\", lambda = 0.5) #> [1] 1 2 4 1 1"},{"path":"https://epiverse-trace.github.io/bpmodels/articles/bpmodels.html","id":"simulating-trees","dir":"Articles","previous_headings":"Quick start > chain_sim(): simulate transmission chains with branching processes","what":"Simulating trees","title":"Analysing infectious disease transmission chains with bpmodels","text":"simulate tree transmission chains, specify serial interval generation function (serial_interval()) set tree = TRUE follows:","code":"set.seed(12) serial_interval <- function(n) { rlnorm(n, meanlog = 0.58, sdlog = 1.58) } chains_df <- chain_sim( n = 5, offspring = \"pois\", lambda = 0.5, stat = \"length\", infinite = 100, serial = serial_interval, tree = TRUE ) head(chains_df) #> n id ancestor generation time #> 1 1 1 NA 1 0.00000000 #> 2 2 1 NA 1 0.00000000 #> 3 3 1 NA 1 0.00000000 #> 4 4 1 NA 1 0.00000000 #> 5 5 1 NA 1 0.00000000 #> 6 2 2 1 2 0.09968906"},{"path":[]},{"path":"https://epiverse-trace.github.io/bpmodels/articles/branching_process_literature.html","id":"note","dir":"Articles","previous_headings":"","what":"Note","title":"Literature on branching process applications","text":"bpmodels now retired longer maintained. recommend using {epichains} instead. need help converting code use {epichains}, please open discussion epichains. , provide bibliography application branching processes infectious disease modelling. intention grow list serve point reference budding modellers interest subject. like extend list, easiest way file issue, listing new additions ’ll take , submit pull request updated version bibliography file found “vignettes/branching_process_literature.json”.","code":""},{"path":[]},{"path":"https://epiverse-trace.github.io/bpmodels/articles/projecting_incidence.html","id":"note","dir":"Articles","previous_headings":"","what":"Note","title":"Projecting infectious disease incidence: a COVID-19 example","text":"bpmodels now retired longer maintained. recommend using {epichains} instead. need help converting code use {epichains}, please open discussion epichains.","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/articles/projecting_incidence.html","id":"overview","dir":"Articles","previous_headings":"Note","what":"Overview","title":"Projecting infectious disease incidence: a COVID-19 example","text":"Branching processes can used project infectious disease trends time provided can characterise distribution times symptom onset successive cases (serial interval), distribution secondary cases produced single individual (offspring distribution). simulations can achieved bpmodels chain_sim() function Pearson et al. (2020), Abbott et al. (2020) illustrate application COVID-19. purpose vignette use early data COVID-19 South Africa (Marivate Combrink 2020) illustrate bpmodels can used project incidence outbreak. Let’s load required packages","code":"library(\"bpmodels\") library(\"dplyr\") library(\"ggplot2\") library(\"lubridate\")"},{"path":"https://epiverse-trace.github.io/bpmodels/articles/projecting_incidence.html","id":"data","dir":"Articles","previous_headings":"Note","what":"Data","title":"Projecting infectious disease incidence: a COVID-19 example","text":"Included bpmodels cleaned time series first 15 days COVID-19 outbreak South Africa. can loaded memory follows: Let us examine first 6 entries dataset.","code":"data(\"covid19_sa\", package = \"bpmodels\") head(covid19_sa) #> # A tibble: 6 × 2 #> date cases #> #> 1 2020-03-05 1 #> 2 2020-03-07 1 #> 3 2020-03-08 1 #> 4 2020-03-09 4 #> 5 2020-03-11 6 #> 6 2020-03-12 3"},{"path":[]},{"path":"https://epiverse-trace.github.io/bpmodels/articles/projecting_incidence.html","id":"onset-times","dir":"Articles","previous_headings":"Note > Setting up the inputs","what":"Onset times","title":"Projecting infectious disease incidence: a COVID-19 example","text":"chain_sim() requires vector onset times, t0, chain/individual/simulation. covid19_sa dataset aggregated, disaggregate linelist row representing case onset time. achieve , first use date index case reference find difference date reference. Using vector start times time series, create linelist disaggregating time series case corresponding start time.","code":"days_since_index <- as.integer(covid19_sa$date - min(covid19_sa$date)) days_since_index #> [1] 0 2 3 4 6 7 8 9 10 11 12 13 14 15 start_times <- unlist(mapply( function(x, y) rep(x, times = ifelse(y == 0, 1, y)), days_since_index, covid19_sa$cases )) start_times #> [1] 0 2 3 4 4 4 4 6 6 6 6 6 6 7 7 7 8 8 8 8 8 8 8 8 9 #> [26] 9 9 9 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 10 10 #> [51] 10 11 11 11 11 11 11 11 11 11 11 11 12 12 12 12 12 12 12 12 12 12 12 12 12 #> [76] 12 12 12 12 12 12 12 12 12 12 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 #> [101] 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 14 14 14 14 14 14 14 14 14 #> [126] 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 #> [151] 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 #> [176] 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 #> [201] 15 15"},{"path":"https://epiverse-trace.github.io/bpmodels/articles/projecting_incidence.html","id":"serial-interval","dir":"Articles","previous_headings":"Note > Setting up the inputs","what":"Serial interval","title":"Projecting infectious disease incidence: a COVID-19 example","text":"log-normal distribution commonly used epidemiology characterise quantities serial interval large variance can positive-valued (Nishiura 2007; Limpert, Stahel, Abbt 2001). example, assume based COVID-19 literature serial interval, S, log-normal distributed parameters, \\(\\mu = 4.7\\) \\(\\sigma = 2.9\\) (Pearson et al. 2020). Note distribution described way, means \\(\\mu\\) \\(\\sigma\\) expected value standard deviation natural logarithm serial interval. Hence, order sample “back-transformed” measured serial interval expectation/mean, \\(E[S]\\) standard deviation, \\(SD [S]\\), can use following parametrisation: \\[\\begin{align} E[S] &= \\ln \\left( \\dfrac{\\mu^2}{(\\sqrt{\\mu^2 + \\sigma^2}} \\right) \\\\ SD [S] &= \\sqrt {\\ln \\left(1 + \\dfrac{\\sigma^2}{\\mu^2} \\right)} \\end{align}\\] See “log-normal_distribution” Wikipedia detailed explanation parametrisation. now set serial interval function appropriate inputs. adopt R’s random lognormal distribution generator (rlnorm()) takes meanlog sdlog arguments, define parametrisation log_mean() log_sd() respectively wrap serial_interval() function. Moreover, serial_interval() takes one argument sample_size required bpmodels (See ?bpmodels::chain_sim), passed rlnorm() first argument determine number observations sample (See ?rlnorm).","code":"mu <- 4.7 sgma <- 2.9 log_mean <- log((mu^2) / (sqrt(sgma^2 + mu^2))) # log mean log_sd <- sqrt(log(1 + (sgma / mu)^2)) # log sd #' serial interval function serial_interval <- function(sample_size) { si <- rlnorm(sample_size, meanlog = log_mean, sdlog = log_sd) return(si) }"},{"path":"https://epiverse-trace.github.io/bpmodels/articles/projecting_incidence.html","id":"offspring-distribution","dir":"Articles","previous_headings":"Note > Setting up the inputs","what":"Offspring distribution","title":"Projecting infectious disease incidence: a COVID-19 example","text":"negative binomial distribution commonly used epidemiology account individual variation transmissibility, also known superspreading (Lloyd-Smith et al. 2005). example, assume offspring distribution characterised negative binomial \\(R = 2.5\\) (Abbott et al. 2020) \\(k = 0.58\\) (Wang et al. 2020). parameterization, \\(R\\) represents \\(R_0\\), defined average number cases produced single individual entirely susceptible population. parameter \\(k\\) represents superspreading, , degree heterogeneity transmission single individuals.","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/articles/projecting_incidence.html","id":"simulation-controls","dir":"Articles","previous_headings":"Note > Setting up the inputs","what":"Simulation controls","title":"Projecting infectious disease incidence: a COVID-19 example","text":"chain_sim() also requires end time simulations. example, simulate outbreaks end 14 days last date observations covid19_sa. chain_sim() stochastic, meaning results different every time run set parameters, run simulations many times summarise results. , therefore, run simulation \\(100\\) times.","code":"#' Date to end simulation (14 day projection in this case) projection_window <- 14 # 14 days/ 2-week ahead projection projection_end_day <- max(days_since_index) + projection_window projection_end_day #> [1] 29 #' Number of simulations sim_rep <- 100"},{"path":"https://epiverse-trace.github.io/bpmodels/articles/projecting_incidence.html","id":"modelling-assumptions","dir":"Articles","previous_headings":"Note","what":"Modelling assumptions","title":"Projecting infectious disease incidence: a COVID-19 example","text":"chain_sim() makes following simplifying assumptions: cases observed reporting delay Reporting rate constant course epidemic interventions implemented Population homogeneous well-mixed cases start chains transmission proceed independently without competition depletion susceptibles. implies none cases seen far infected . summarise whole set far, going simulate chain 100 times, projecting COVID-19 cases 14 days first \\(15\\) days.","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/articles/projecting_incidence.html","id":"running-the-simulations","dir":"Articles","previous_headings":"Note","what":"Running the simulations","title":"Projecting infectious disease incidence: a COVID-19 example","text":"use function lapply() run simulations bind rows dplyr::bind_rows(). Let us view first rows simulation results.","code":"set.seed(1234) sim_chain_sizes <- lapply( seq_len(sim_rep), function(sim) { chain_sim( n = length(start_times), offspring = \"nbinom\", mu = 2.5, size = 0.58, stat = \"size\", serial = serial_interval, t0 = start_times, tf = projection_end_day, tree = TRUE ) %>% mutate(sim = sim) } ) sim_output <- bind_rows(sim_chain_sizes) head(sim_output) #> n id ancestor generation time sim #> 1 1 1 NA 1 0 1 #> 2 2 1 NA 1 2 1 #> 3 3 1 NA 1 3 1 #> 4 4 1 NA 1 4 1 #> 5 5 1 NA 1 4 1 #> 6 6 1 NA 1 4 1"},{"path":"https://epiverse-trace.github.io/bpmodels/articles/projecting_incidence.html","id":"post-processing","dir":"Articles","previous_headings":"Note","what":"Post-processing","title":"Projecting infectious disease incidence: a COVID-19 example","text":"Now, summarise simulation results. want plot individual simulated daily time series show median cases per day aggregated simulations. First, create daily time series per simulation aggregating number cases per day simulation. Next, add date column results simulation set. use date first case observed data reference start date. Now aggregate simulations day evaluate median daily cases across simulations.","code":"# Daily number of cases for each simulation incidence_ts <- sim_output %>% mutate(day = ceiling(time)) %>% group_by(sim, day) %>% summarise(cases = n()) %>% ungroup() head(incidence_ts) #> # A tibble: 6 × 3 #> sim day cases #> #> 1 1 0 1 #> 2 1 2 1 #> 3 1 3 1 #> 4 1 4 4 #> 5 1 6 6 #> 6 1 7 4 # Get start date from the observed data index_date <- min(covid19_sa$date) index_date #> [1] \"2020-03-05\" # Add a dates column to each simulation result incidence_ts_by_date <- incidence_ts %>% group_by(sim) %>% mutate(date = index_date + days(seq(0, n() - 1))) %>% ungroup() head(incidence_ts_by_date) #> # A tibble: 6 × 4 #> sim day cases date #> #> 1 1 0 1 2020-03-05 #> 2 1 2 1 2020-03-06 #> 3 1 3 1 2020-03-07 #> 4 1 4 4 2020-03-08 #> 5 1 6 6 2020-03-09 #> 6 1 7 4 2020-03-10 # Median daily number of cases aggregated across all simulations median_daily_cases <- incidence_ts_by_date %>% group_by(date) %>% summarise(median_cases = median(cases)) %>% ungroup() %>% arrange(date) head(median_daily_cases) #> # A tibble: 6 × 2 #> date median_cases #> #> 1 2020-03-05 1 #> 2 2020-03-06 1 #> 3 2020-03-07 1 #> 4 2020-03-08 4 #> 5 2020-03-09 4 #> 6 2020-03-10 8"},{"path":"https://epiverse-trace.github.io/bpmodels/articles/projecting_incidence.html","id":"visualization","dir":"Articles","previous_headings":"Note","what":"Visualization","title":"Projecting infectious disease incidence: a COVID-19 example","text":"now plot individual simulation results alongside median aggregated results. Figure 1: COVID-19 incidence South Africa projected two week window 2020. light gray lines represent individual simulations, red line represents median daily cases across simulations, black connected dots represent observed data, dashed vertical line marks beginning projection.","code":"## since all simulations may end at a different date, we will find the minimum ## final date for all simulations for the purposes of visualisation final_date <- incidence_ts_by_date %>% group_by(sim) %>% summarise(final_date = max(date), .groups = \"drop\") %>% summarise(min_final_date = min(final_date)) %>% pull(min_final_date) incidence_ts_by_date <- incidence_ts_by_date %>% filter(date <= final_date) median_daily_cases <- median_daily_cases %>% filter(date <= final_date) ggplot(data = incidence_ts_by_date) + geom_line( aes( x = date, y = cases, group = sim ), color = \"grey\", linewidth = 0.2, alpha = 0.25 ) + geom_line( data = median_daily_cases, aes( x = date, y = median_cases ), color = \"tomato3\", linewidth = 1.8 ) + geom_point( data = covid19_sa, aes( x = date, y = cases ), color = \"black\", size = 1.75, shape = 21 ) + geom_line( data = covid19_sa, aes( x = date, y = cases ), color = \"black\", linewidth = 1 ) + scale_x_continuous( breaks = seq( min(incidence_ts_by_date$date), max(incidence_ts_by_date$date), 5 ), labels = seq( min(incidence_ts_by_date$date), max(incidence_ts_by_date$date), 5 ) ) + scale_y_continuous( breaks = seq( 0, max(incidence_ts_by_date$cases) + 200, 250 ), labels = seq( 0, max(incidence_ts_by_date$cases) + 200, 250 ) ) + geom_vline( mapping = aes(xintercept = max(covid19_sa$date)), linetype = \"dashed\" ) + labs(x = \"Date\", y = \"Daily cases\")"},{"path":[]},{"path":"https://epiverse-trace.github.io/bpmodels/articles/theoretical_background.html","id":"note","dir":"Articles","previous_headings":"","what":"Note","title":"Theoretical background for bpmodels","text":"bpmodels now retired longer maintained. recommend using {epichains} instead. need help converting code use {epichains}, please open discussion epichains. bpmodels provides methods analyse simulate size length branching processes arbitrary offspring distribution. vignette lay mathematical concepts behind functionality available package.","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/articles/theoretical_background.html","id":"branching-processes","dir":"Articles","previous_headings":"","what":"Branching processes","title":"Theoretical background for bpmodels","text":"Branching processes class models used model growth populations. assume member population produces number offspring, \\(Z\\), random variable probability mass function \\(p(Z = z | \\theta)\\), called offspring distribution. use long history epidemiology, population interpreted pathogen, offspring new hosts infects (Farrington, Kanaan, Gay 2003). call infected individuals cases methods applied contexts branching processes used.","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/articles/theoretical_background.html","id":"simulation","dir":"Articles","previous_headings":"","what":"Simulation","title":"Theoretical background for bpmodels","text":"simulate branching process, start single case proceed discrete steps generations, drawing offspring distribution \\(p(Z=z | \\theta)\\) generate new cases case. Given infector \\(\\) infectee \\(j\\), can additionally assign distribution times \\(T\\) approximates infection event occurred. define \\(T\\) random variable distribution \\(f(T = t; \\theta)\\) can assign case \\(j\\) time \\(t_{j}\\) , case \\(j\\) affected case \\(\\) given \\(f(t_{j} - t_{} | \\theta)\\). identify timing cases time symptom onset serial interval, depending case definitions another interval.","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/articles/theoretical_background.html","id":"summary-statistics","dir":"Articles","previous_headings":"Simulation","what":"Summary statistics","title":"Theoretical background for bpmodels","text":"Branching process simulations end gone extinct, , offspring produced, stopping criterion. summarise simulations, either study size length resulting chain cases. size \\(S\\) chain number cases occurred course simulation including initial case \\(S \\geq 1\\). length \\(L\\) chain number generations simulated including initial case \\(L \\geq 1\\).","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/articles/theoretical_background.html","id":"inference","dir":"Articles","previous_headings":"","what":"Inference","title":"Theoretical background for bpmodels","text":"characterising chains cases size length can conduct inference learn underlying parameters \\(\\theta\\) observation chain sizes chain lengths (Blumberg Lloyd-Smith 2013). general possible subcritical branching processes, .e. ones mean number offspring less 1, otherwise branching process grow forever. However, can expand theory supercritical branching processes, .e. ones mean number offspring greater 1, defining cutoff chain size length beyond treat chain infinite size length, respectively.","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/articles/theoretical_background.html","id":"size-and-length-distributions-for-some-offspring-distributions","dir":"Articles","previous_headings":"Inference","what":"Size and length distributions for some offspring distributions","title":"Theoretical background for bpmodels","text":"show equations size length distributions offspring distributions can derived analytically: Poisson, negative binomial, geometric, gamma-Borel mixture.","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/articles/theoretical_background.html","id":"negative-binomial-and-special-cases","dir":"Articles","previous_headings":"Inference > Size and length distributions for some offspring distributions","what":"Negative binomial and special cases","title":"Theoretical background for bpmodels","text":"offspring distribution Poisson distribution, can interpret rate parameter \\(\\lambda\\) basic reproduction number \\(R_{0}\\) pathogen. general case offspring definition can overdispersed leading superspreading can use negative binomial offspring distribution mean \\(\\mu\\) overdispersion \\(k\\) Blumberg Lloyd-Smith (2013). case, mean parameter \\(\\mu\\) interpreted basic reproduction number \\(R_0\\) pathogen. negative binomial distribution arises Poisson-gamma mixture thus branching process negative binomial distributed offspring can interpreted one Poisson distributed offspring basic reproduction number \\(R_0\\) varies according gamma distribution. amount variation \\(R_0\\) interpreted individual-level variation transmission representing overdispersion superspreading, degree happens given overdispersion parameter \\(k\\).","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/articles/theoretical_background.html","id":"size-distributions","dir":"Articles","previous_headings":"Inference > Size and length distributions for some offspring distributions > Negative binomial and special cases","what":"Size distributions","title":"Theoretical background for bpmodels","text":"probability \\(p\\) chain size \\(S\\) given \\(R_0\\) \\(k\\) branching process negative binomial offspring distribution given Eq. 9 Blumberg Lloyd-Smith (2013) \\[ p(S|R_0, k) = \\frac{\\Gamma(kS + S - 1)}{\\Gamma(kS)\\Gamma(S + 1)} \\frac{\\left(\\frac{R_0}{k}\\right)^{S - 1}}{\\left( 1 + \\frac{R_0}{k} \\right)^{kS + S - 1}} \\] \\(\\Gamma\\) gamma function. order estimate \\(S\\) given \\(R_0\\) \\(k\\) can define likelihood function \\(L(S) = p(S|R_0, k)\\). corresponding log-likelihood \\[\\begin{align} \\mathrm{LL}(S) = &\\log\\Gamma(kS + S - 1) - \\left(\\log\\Gamma(kS) + \\log\\Gamma(S - 1) \\right) \\\\ & + (S-1) \\log \\frac{R_0}{k} - (SR_0 + (S - 1)) \\log \\left(1 + \\frac{R_0}{k}\\right) \\end{align}\\] log-likelihood Poisson distributed offspring follows \\(k\\) tends infinity (corresponding Eq. 2.2 Farrington, Kanaan, Gay (2003)) \\[ \\mathrm{LL}(S) = (S - 1) \\log R_0 - S R_0 + (S - 2) \\log S - \\log\\Gamma(S) \\] cases point estimate basic reproduction number \\(\\hat{R_0}\\) related mean chain size \\(\\bar{S}\\) \\[ \\hat{R_0} = 1 - \\frac{1}{\\bar{S}} \\]","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/articles/theoretical_background.html","id":"length-distributions","dir":"Articles","previous_headings":"Inference > Size and length distributions for some offspring distributions > Negative binomial and special cases","what":"Length distributions","title":"Theoretical background for bpmodels","text":"cumulative mass function \\(F(L)\\) observing chain length \\(L\\) offspring Poisson distributed given Eq. (2.5) Farrington, Kanaan, Gay (2003) (called “outbreak duration”): \\[ F(L) = e^{-R_0} E_L \\left( e^{R_0 e^{-R_0} } \\right) \\] \\(E_L(x)\\) iterated exponential function, \\(E_0(x) = 1\\), \\(E_{L + 1}(x) = x^{E_L(x)}\\). geometric distributed offspring (corresponding negative Binomial \\(k=1\\)) function given \\[ F(L) = \\frac{ 1- R_0^{L + 1} } {1 - R_0^{L - 2}} \\] cases \\(f(L)\\) denotes cumulative mass functions therefore probability observing chain length \\(L\\) therefore \\(f(L) - f(L - 1)\\).","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/articles/theoretical_background.html","id":"gamma-borel-mixture","dir":"Articles","previous_headings":"Inference > Size and length distributions for some offspring distributions","what":"Gamma-Borel mixture","title":"Theoretical background for bpmodels","text":"probability distribution outbreak sizes branching process Poisson offspring distribution (Eq. 2.2 Farrington, Kanaan, Gay (2003)) special case Borel-Tanner distribution starting 1 individual. alternative negative binomial offspring distribution represents Poisson-gamma mixture Borel-gamma mixture. represent situations variation individual level chain level, .e. transmission chains homogeneous heterogeneity chains. case, can shown resulting log-likelihood chain sizes \\[\\begin{align} \\mathrm{LL}(S) = &\\log\\Gamma(k + S - 1) - \\left(\\log\\Gamma(k) + \\log\\Gamma(S + 1) \\right) \\\\ & + (S-1) \\log S - k \\log \\left(S + \\frac{R_0}{k}\\right) \\end{align}\\]","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/articles/theoretical_background.html","id":"numerical-approximations-of-chain-size-and-length-distributions","dir":"Articles","previous_headings":"Inference","what":"Numerical approximations of chain size and length distributions","title":"Theoretical background for bpmodels","text":"analytic likelihoods available numerical approximation used derive distributions. order , simulation functionality used generate \\(n\\) simulated chains value cumulative mass function \\(P(S|\\theta)\\) observed \\(S\\) approximated empirical cumulative distribution function: \\[ P(S|\\theta) \\approx \\sum_i \\mathbf{1}(x_i <= S) \\] \\(\\mathbf{1}\\) indicator function \\(x_i\\) -th observed chain size (length, interest \\(L\\)). order improve approximation linear approximation applied values empirical distribution function (expense normalisation 1). (unnormalised) probability observing \\(S\\) given \\[ p(S|\\theta) = P(S|\\theta) - P(S - 1|\\theta) \\] equivalent relationship used \\(L\\).","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"James M. Azam. Author, maintainer. Zhian N. Kamvar. Contributor. Flavio Finger. Author. Sebastian Funk. Author, copyright holder. Joshua W. Lambert. Reviewer. Pratik Gupte. Reviewer. Hugo Gruson. Reviewer.","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Sebastian Funk, Flavio Finger, James M. Azam (2023). bpmodels: Analysing transmission chain statistics using branching process models, website: https://github.com/epiverse-trace/bpmodels/","code":"@Manual{, title = {bpmodels: Analysing transmission chain statistics using branching process models}, author = {{Sebastian Funk} and {Flavio Finger} and {James M. Azam}}, year = {2023}, url = {https://github.com/epiverse-trace/bpmodels/}, }"},{"path":[]},{"path":"https://epiverse-trace.github.io/bpmodels/index.html","id":"note","dir":"","previous_headings":"","what":"Note","title":"Simulating and Analysing Transmission Chain Statistics using Branching Process Models","text":"bpmodels now retired longer maintained. recommend using {epichains} instead. need help converting code use {epichains}, please open discussion epichains. bpmodels R package simulate analyse size length branching processes given offspring distribution. models often used infectious disease epidemiology, chains represent chains transmission, offspring distribution represents distribution secondary infections caused infected individual.","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Simulating and Analysing Transmission Chain Statistics using Branching Process Models","text":"latest development version bpmodels package can installed via load package, use","code":"# check whether {pak} is installed if (!require(\"pak\")) install.packages(\"pak\") pak::pkg_install(\"epiverse-trace/bpmodels\") library(\"bpmodels\") #> Note: bpmodels is now retired and replaced by epichains. All features from bpmodels are available in epichains. Get epichains from .Thank you for your support!"},{"path":"https://epiverse-trace.github.io/bpmodels/index.html","id":"core-functionality","dir":"","previous_headings":"","what":"Core functionality","title":"Simulating and Analysing Transmission Chain Statistics using Branching Process Models","text":"bpmodels provides three main functions: chain_ll(): calculates likelihoods observing vector chains given sizes lengths. quick example estimating loglikelihood observed chain: chain_sim(): simulates transmission chains chains stop producing offspring. quick example simulate chain sizes 5 chains poisson offspring mean, lambda = 0.5: chain_sim_susc(): simulates transmission chains specified population size pre-existing immunity susceptible pool runs . quick example simulate chains poisson offspring mean, lambda = 0.5, serial interval 3: See “Get started vignette” detailed illustration function.","code":"# example of observed chain sizes chain_sizes <- c(1, 2, 3, 4) # estimate loglikelihood of the observed chain sizes chain_ll_eg <- chain_ll(x = chain_sizes, offspring = \"pois\", stat = \"size\", lambda = 0.5) chain_ll_eg #> [1] -7.772589 set.seed(123) chain_sim_eg <- chain_sim(n = 5, offspring = \"pois\", stat = \"size\", lambda = 0.5, tree = TRUE) head(chain_sim_eg) #> n id ancestor generation #> 1 1 1 NA 1 #> 2 2 1 NA 1 #> 3 3 1 NA 1 #> 4 4 1 NA 1 #> 5 5 1 NA 1 #> 6 2 2 1 2 set.seed(1234) chain_sim_susc_eg <- chain_sim_susc(pop = 1000, offspring = \"pois\", mn_offspring = 0.5, serial = function(x) {3} ) head(chain_sim_susc_eg) #> id ancestor generation time #> 1 1 NA 1 0"},{"path":"https://epiverse-trace.github.io/bpmodels/index.html","id":"package-vignettes","dir":"","previous_headings":"","what":"Package vignettes","title":"Simulating and Analysing Transmission Chain Statistics using Branching Process Models","text":"Specific use cases bpmodels can found online documentation package vignettes, “Articles”.","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/index.html","id":"reporting-bugs","dir":"","previous_headings":"","what":"Reporting bugs","title":"Simulating and Analysing Transmission Chain Statistics using Branching Process Models","text":"report bug please open issue.","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/index.html","id":"contribute","dir":"","previous_headings":"","what":"Contribute","title":"Simulating and Analysing Transmission Chain Statistics using Branching Process Models","text":"welcome contributions enhance package’s functionalities. wish , please follow package contributing guide.","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/index.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of conduct","title":"Simulating and Analysing Transmission Chain Statistics using Branching Process Models","text":"Please note bpmodels project released Contributor Code Conduct. contributing project, agree abide terms.","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/index.html","id":"citing-this-package","dir":"","previous_headings":"","what":"Citing this package","title":"Simulating and Analysing Transmission Chain Statistics using Branching Process Models","text":"","code":"citation(\"bpmodels\") #> To cite package bpmodels in publications use: #> #> Sebastian Funk, Flavio Finger, and James M. Azam (2023). bpmodels: #> Analysing transmission chain statistics using branching process #> models, website: https://github.com/epiverse-trace/bpmodels/ #> #> A BibTeX entry for LaTeX users is #> #> @Manual{, #> title = {bpmodels: Analysing transmission chain statistics using branching process models}, #> author = {{Sebastian Funk} and {Flavio Finger} and {James M. Azam}}, #> year = {2023}, #> url = {https://github.com/epiverse-trace/bpmodels/}, #> }"},{"path":"https://epiverse-trace.github.io/bpmodels/reference/bpmodels-package.html","id":null,"dir":"Reference","previous_headings":"","what":"bpmodels: Simulating and Analysing Transmission Chain Statistics using Branching Process Models — bpmodels-package","title":"bpmodels: Simulating and Analysing Transmission Chain Statistics using Branching Process Models — bpmodels-package","text":"Provides methods simulate analyse size length branching processes arbitrary offspring distribution. can used, example, analyse distribution chain sizes length infectious disease outbreaks, discussed Farrington et al. (2003) doi:10.1093/biostatistics/4.2.279 .","code":""},{"path":[]},{"path":"https://epiverse-trace.github.io/bpmodels/reference/bpmodels-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"bpmodels: Simulating and Analysing Transmission Chain Statistics using Branching Process Models — bpmodels-package","text":"Maintainer: James M. Azam james.azam@lshtm.ac.uk (ORCID) Authors: Flavio Finger flavio.finger@epicentre.msf.org (ORCID) Sebastian Funk sebastian.funk@lshtm.ac.uk (ORCID) [copyright holder] contributors: Zhian N. Kamvar zkamvar@gmail.com (ORCID) [contributor]","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/chain_ll.html","id":null,"dir":"Reference","previous_headings":"","what":"Calculate the log-likelihood for the outcome of a branching process — chain_ll","title":"Calculate the log-likelihood for the outcome of a branching process — chain_ll","text":"Calculate log-likelihood outcome branching process","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/chain_ll.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Calculate the log-likelihood for the outcome of a branching process — chain_ll","text":"","code":"chain_ll( x, offspring, stat = c(\"size\", \"length\"), obs_prob = 1, infinite = Inf, exclude = NULL, individual = FALSE, nsim_obs, ... )"},{"path":"https://epiverse-trace.github.io/bpmodels/reference/chain_ll.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Calculate the log-likelihood for the outcome of a branching process — chain_ll","text":"x vector sizes lengths transmission chains offspring Offspring distribution: character string corresponding R distribution function (e.g., \"pois\" Poisson, rpois R function generate Poisson random numbers) stat statistic given x (\"size\" \"length\" chains) obs_prob observation probability (assumed constant) infinite chains size/length treated infinite exclude sizes/lengths exclude log-likelihood calculation individual TRUE, vector individual log-likelihood contributions returned rather sum nsim_obs number simulations log-likelihood approximated imperfect observations ... parameters offspring distribution","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/chain_ll.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Calculate the log-likelihood for the outcome of a branching process — chain_ll","text":"log-likelihood, vector log-likelihoods (obs_prob < 1), list individual log-likelihood contributions (individual=TRUE)","code":""},{"path":[]},{"path":"https://epiverse-trace.github.io/bpmodels/reference/chain_ll.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Calculate the log-likelihood for the outcome of a branching process — chain_ll","text":"Sebastian Funk","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/chain_ll.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Calculate the log-likelihood for the outcome of a branching process — chain_ll","text":"","code":"chain_sizes <- c(1, 1, 4, 7) # example of observed chain sizes chain_ll(chain_sizes, \"pois\", \"size\", lambda = 0.5) #> [1] -8.607196"},{"path":"https://epiverse-trace.github.io/bpmodels/reference/chain_sim.html","id":null,"dir":"Reference","previous_headings":"","what":"Simulate transmission chains using a branching process — chain_sim","title":"Simulate transmission chains using a branching process — chain_sim","text":"chain_sim() stochastic simulator generating transmission chain data key inputs offspring distribution serial interval distribution.","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/chain_sim.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Simulate transmission chains using a branching process — chain_sim","text":"","code":"chain_sim( n, offspring, stat = c(\"size\", \"length\"), infinite = Inf, tree = FALSE, serial, t0 = 0, tf = Inf, ... )"},{"path":"https://epiverse-trace.github.io/bpmodels/reference/chain_sim.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Simulate transmission chains using a branching process — chain_sim","text":"n Number simulations run. offspring Offspring distribution: character string corresponding R distribution function (e.g., \"pois\" Poisson, rpois R function generate Poisson random numbers) stat String; Statistic calculate. Can one : \"size\": total number offspring. \"length\": total number ancestors. infinite size length simulation results set Inf. Defaults Inf, resulting results ever set Inf tree Logical. transmission tree returned? Defaults FALSE. serial serial interval generator function; name user-defined named anonymous function one argument n, representing number serial intervals generate. t0 Start time (serial interval given); either single value vector length n (number simulations) initial times. Defaults 0. tf End time (serial interval given). ... Parameters offspring distribution required R.","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/chain_sim.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Simulate transmission chains using a branching process — chain_sim","text":"Either: vector sizes/lengths (tree == FALSE serial interval function specified, since implies tree == FALSE), data frame columns n (simulation ID), time (serial interval given) (tree == TRUE), id (unique ID within simulation individual element chain), ancestor (ID ancestor element), generation.","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/chain_sim.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Simulate transmission chains using a branching process — chain_sim","text":"chain_sim() either returns vector data.frame. output either vector serial provided, automatically sets tree = FALSE, data.frame, means serial provided function. serial provided, means tree = TRUE automatically. However, setting tree = TRUE require providing function serial.","code":""},{"path":[]},{"path":"https://epiverse-trace.github.io/bpmodels/reference/chain_sim.html","id":"assumptions-disambiguation","dir":"Reference","previous_headings":"","what":"Assumptions/disambiguation","title":"Simulate transmission chains using a branching process — chain_sim","text":"epidemiology, generation interval duration successive infectious events chain transmission. Similarly, serial interval duration observed symptom onset times successive cases transmission chain. generation interval often hard observe exact times infection hard measure hence, serial interval often used instead. , use serial interval represent normally called generation interval, , time successive cases.","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/chain_sim.html","id":"specifying-serial-in-chain-sim-","dir":"Reference","previous_headings":"","what":"Specifying serial in chain_sim()","title":"Simulate transmission chains using a branching process — chain_sim","text":"serial must specified named anonymous/inline/unnamed function # nolint one argument. serial specified, chain_sim() returns times infection column output. Moreover, specifying function serial implies tree = TRUE tree infectors (ancestor) infectees (id) generated output. example, assuming want specify serial interval generator random log-normally distributed variable meanlog = 0.58 sdlog = 1.58, define named function, call \"serial_interval\", one argument representing number serial intervals sample: serial_interval <- function(n){rlnorm(n, 0.58, 1.38)}, assign name function serial chain_sim() like chain_sim(..., serial = serial_interval), ... arguments chain_sim(). Alternatively, assign anonymous function serial chain_sim() call like chain_sim(..., serial = function(n){rlnorm(n, 0.58, 1.38)}), ... arguments chain_sim().","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/chain_sim.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Simulate transmission chains using a branching process — chain_sim","text":"Sebastian Funk, James M. Azam","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/chain_sim.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Simulate transmission chains using a branching process — chain_sim","text":"","code":"# Specifying no `serial` and `tree == FALSE` (default) returns a vector set.seed(123) chain_sim(n = 5, offspring = \"pois\", stat = \"size\", lambda = 0.5, tree = FALSE) #> [1] 1 2 1 2 4 # Specifying `serial` without specifying `tree` will set `tree = TRUE` # internally. # We'll first define the serial function set.seed(123) serial_interval <- function(n) { rlnorm(n, meanlog = 0.58, sdlog = 1.58) } chain_sim( n = 5, offspring = \"pois\", lambda = 0.5, stat = \"length\", infinite = 100, serial = serial_interval ) #> n id ancestor generation time #> 1 1 1 NA 1 0.0000000 #> 2 2 1 NA 1 0.0000000 #> 3 3 1 NA 1 0.0000000 #> 4 4 1 NA 1 0.0000000 #> 5 5 1 NA 1 0.0000000 #> 6 2 2 1 2 0.1237492 #> 7 4 2 1 2 12.6594440 #> 8 5 2 1 2 1.5035572 #> 9 5 3 1 2 1.4840246 #> 10 5 4 2 3 1.6201477 #> 11 5 5 4 4 13.9750044 #> 12 5 6 4 4 4.7736253 #> 13 5 7 5 5 16.1023578 #> 14 5 8 6 5 5.5157567 #> 15 5 9 7 6 20.0243658 #> 16 5 10 7 6 16.1822358 #> 17 5 11 8 6 10.9251791 # Specifying `serial` and `tree = FALSE` will throw a warning saying that # `tree` was set to `TRUE` internally. set.seed(123) if (FALSE) { try(chain_sim( n = 10, serial = function(x) 3, offspring = \"pois\", lambda = 2, infinite = 10, tree = FALSE )) }"},{"path":"https://epiverse-trace.github.io/bpmodels/reference/chain_sim_susc.html","id":null,"dir":"Reference","previous_headings":"","what":"Simulate a single chain using a branching process while accounting for depletion of susceptibles. — chain_sim_susc","title":"Simulate a single chain using a branching process while accounting for depletion of susceptibles. — chain_sim_susc","text":"Simulate single chain using branching process accounting depletion susceptibles.","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/chain_sim_susc.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Simulate a single chain using a branching process while accounting for depletion of susceptibles. — chain_sim_susc","text":"","code":"chain_sim_susc( offspring = c(\"pois\", \"nbinom\"), mn_offspring, disp_offspring, serial, t0 = 0, tf = Inf, pop, initial_immune = 0 )"},{"path":"https://epiverse-trace.github.io/bpmodels/reference/chain_sim_susc.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Simulate a single chain using a branching process while accounting for depletion of susceptibles. — chain_sim_susc","text":"offspring offspring distribution: character string corresponding R distribution function. Currently \"pois\" & \"nbinom\" supported. Internally truncated distributions used avoid infecting people susceptibles available. mn_offspring average number secondary cases case disp_offspring dispersion coefficient (var/mean) number secondary cases. Ignored offspring == \"pois\". Must > 1. serial serial interval. function takes one parameter (n), number serial intervals randomly sample. Value must >= 0. t0 start time tf end time pop population initial_immune number initial immunes population","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/chain_sim_susc.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Simulate a single chain using a branching process while accounting for depletion of susceptibles. — chain_sim_susc","text":"data frame columns time, id (unique ID individual element chain), ancestor (ID ancestor element), generation.","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/chain_sim_susc.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Simulate a single chain using a branching process while accounting for depletion of susceptibles. — chain_sim_susc","text":"function couple key differences chain_sim: can simulate one chain time, can handle implemented offspring distributions (\"pois\" \"nbinom\"), always tracks returns data frame containing entire tree, maximal length chains limited pop instead infinite.","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/chain_sim_susc.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Simulate a single chain using a branching process while accounting for depletion of susceptibles. — chain_sim_susc","text":"Flavio Finger","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/chain_sim_susc.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Simulate a single chain using a branching process while accounting for depletion of susceptibles. — chain_sim_susc","text":"","code":"chain_sim_susc(\"pois\", mn_offspring = 0.5, serial = function(x) 3, pop = 100) #> id ancestor generation time #> 1 1 NA 1 0"},{"path":"https://epiverse-trace.github.io/bpmodels/reference/complementary_logprob.html","id":null,"dir":"Reference","previous_headings":"","what":"Calculates the complementary log-probability — complementary_logprob","title":"Calculates the complementary log-probability — complementary_logprob","text":"Given x norm, calculates log(1-sum(exp(x)))","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/complementary_logprob.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Calculates the complementary log-probability — complementary_logprob","text":"","code":"complementary_logprob(x)"},{"path":"https://epiverse-trace.github.io/bpmodels/reference/complementary_logprob.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Calculates the complementary log-probability — complementary_logprob","text":"x log-probabilities","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/complementary_logprob.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Calculates the complementary log-probability — complementary_logprob","text":"value","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/complementary_logprob.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Calculates the complementary log-probability — complementary_logprob","text":"Sebastian Funk","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/covid19_sa.html","id":null,"dir":"Reference","previous_headings":"","what":"COVID-19 Data Repository for South Africa — covid19_sa","title":"COVID-19 Data Repository for South Africa — covid19_sa","text":"aggregated subset COVID-19 Data Repository South Africa created, maintained hosted Data Science Social Impact research group, led Dr. Vukosi Marivate.","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/covid19_sa.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"COVID-19 Data Repository for South Africa — covid19_sa","text":"","code":"covid19_sa"},{"path":[]},{"path":"https://epiverse-trace.github.io/bpmodels/reference/covid19_sa.html","id":"covid-sa","dir":"Reference","previous_headings":"","what":"covid19_sa","title":"COVID-19 Data Repository for South Africa — covid19_sa","text":"data frame 19 rows 2 columns: date Date case reported cases Number cases","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/covid19_sa.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"COVID-19 Data Repository for South Africa — covid19_sa","text":"https://github.com/dsfsi/covid19za details data-raw/covid19_sa.R.","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/covid19_sa.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"COVID-19 Data Repository for South Africa — covid19_sa","text":"data originally provided linelist subsetted cleaned data-raw/covid19_sa.R.","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/dborel.html","id":null,"dir":"Reference","previous_headings":"","what":"Density of the Borel distribution — dborel","title":"Density of the Borel distribution — dborel","text":"Density Borel distribution","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/dborel.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Density of the Borel distribution — dborel","text":"","code":"dborel(x, mu, log = FALSE)"},{"path":"https://epiverse-trace.github.io/bpmodels/reference/dborel.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Density of the Borel distribution — dborel","text":"x vector quantiles; integer. mu mu parameter (poisson mean); non-negative. log logical; TRUE, probabilities p given log(p).","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/dborel.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Density of the Borel distribution — dborel","text":"probability mass.","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/dborel.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Density of the Borel distribution — dborel","text":"Sebastian Funk","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/gborel_size_ll.html","id":null,"dir":"Reference","previous_headings":"","what":"Log-likelihood of the size of chains with gamma-Borel offspring distribution — gborel_size_ll","title":"Log-likelihood of the size of chains with gamma-Borel offspring distribution — gborel_size_ll","text":"Log-likelihood size chains gamma-Borel offspring distribution","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/gborel_size_ll.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Log-likelihood of the size of chains with gamma-Borel offspring distribution — gborel_size_ll","text":"","code":"gborel_size_ll(x, size, prob, mu)"},{"path":"https://epiverse-trace.github.io/bpmodels/reference/gborel_size_ll.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Log-likelihood of the size of chains with gamma-Borel offspring distribution — gborel_size_ll","text":"x vector sizes size dispersion parameter (often called k ecological applications) prob probability success (parameterisation prob, see also NegBinomial) mu mean parameter","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/gborel_size_ll.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Log-likelihood of the size of chains with gamma-Borel offspring distribution — gborel_size_ll","text":"log-likelihood values","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/gborel_size_ll.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Log-likelihood of the size of chains with gamma-Borel offspring distribution — gborel_size_ll","text":"Sebastian Funk","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/geom_length_ll.html","id":null,"dir":"Reference","previous_headings":"","what":"Log-likelihood of the length of chains with geometric offspring distribution — geom_length_ll","title":"Log-likelihood of the length of chains with geometric offspring distribution — geom_length_ll","text":"Log-likelihood length chains geometric offspring distribution","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/geom_length_ll.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Log-likelihood of the length of chains with geometric offspring distribution — geom_length_ll","text":"","code":"geom_length_ll(x, prob)"},{"path":"https://epiverse-trace.github.io/bpmodels/reference/geom_length_ll.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Log-likelihood of the length of chains with geometric offspring distribution — geom_length_ll","text":"x vector sizes prob probability geometric distribution mean 1/prob","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/geom_length_ll.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Log-likelihood of the length of chains with geometric offspring distribution — geom_length_ll","text":"log-likelihood values","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/geom_length_ll.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Log-likelihood of the length of chains with geometric offspring distribution — geom_length_ll","text":"Sebastian Funk","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/nbinom_size_ll.html","id":null,"dir":"Reference","previous_headings":"","what":"Log-likelihood of the size of chains with Negative-Binomial offspring distribution — nbinom_size_ll","title":"Log-likelihood of the size of chains with Negative-Binomial offspring distribution — nbinom_size_ll","text":"Log-likelihood size chains Negative-Binomial offspring distribution","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/nbinom_size_ll.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Log-likelihood of the size of chains with Negative-Binomial offspring distribution — nbinom_size_ll","text":"","code":"nbinom_size_ll(x, size, prob, mu)"},{"path":"https://epiverse-trace.github.io/bpmodels/reference/nbinom_size_ll.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Log-likelihood of the size of chains with Negative-Binomial offspring distribution — nbinom_size_ll","text":"x vector sizes size dispersion parameter (often called k ecological applications) prob probability success (parameterisation prob, see also NegBinomial) mu mean parameter","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/nbinom_size_ll.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Log-likelihood of the size of chains with Negative-Binomial offspring distribution — nbinom_size_ll","text":"log-likelihood values","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/nbinom_size_ll.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Log-likelihood of the size of chains with Negative-Binomial offspring distribution — nbinom_size_ll","text":"Sebastian Funk","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/offspring_ll.html","id":null,"dir":"Reference","previous_headings":"","what":"Log-likelihood of the length of chains with generic offspring distribution — offspring_ll","title":"Log-likelihood of the length of chains with generic offspring distribution — offspring_ll","text":"likelihoods calculated crude approximation using simulated chains linearly approximating missing values empirical cumulative distribution function (ecdf).","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/offspring_ll.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Log-likelihood of the length of chains with generic offspring distribution — offspring_ll","text":"","code":"offspring_ll(x, offspring, stat, nsim_offspring = 100, ...)"},{"path":"https://epiverse-trace.github.io/bpmodels/reference/offspring_ll.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Log-likelihood of the length of chains with generic offspring distribution — offspring_ll","text":"x vector sizes offspring Offspring distribution: character string corresponding R distribution function (e.g., \"pois\" Poisson, rpois R function generate Poisson random numbers) stat statistic given x (\"size\" \"length\" chains) nsim_offspring number simulations offspring distribution approximation size/length distribution ... parameters pass chain_sim","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/offspring_ll.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Log-likelihood of the length of chains with generic offspring distribution — offspring_ll","text":"log-likelihood values","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/offspring_ll.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Log-likelihood of the length of chains with generic offspring distribution — offspring_ll","text":"Sebastian Funk","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/pois_length_ll.html","id":null,"dir":"Reference","previous_headings":"","what":"Log-likelihood of the length of chains with Poisson offspring distribution — pois_length_ll","title":"Log-likelihood of the length of chains with Poisson offspring distribution — pois_length_ll","text":"Log-likelihood length chains Poisson offspring distribution","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/pois_length_ll.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Log-likelihood of the length of chains with Poisson offspring distribution — pois_length_ll","text":"","code":"pois_length_ll(x, lambda)"},{"path":"https://epiverse-trace.github.io/bpmodels/reference/pois_length_ll.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Log-likelihood of the length of chains with Poisson offspring distribution — pois_length_ll","text":"x vector sizes lambda rate Poisson distribution","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/pois_length_ll.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Log-likelihood of the length of chains with Poisson offspring distribution — pois_length_ll","text":"log-likelihood values","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/pois_length_ll.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Log-likelihood of the length of chains with Poisson offspring distribution — pois_length_ll","text":"Sebastian Funk","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/pois_size_ll.html","id":null,"dir":"Reference","previous_headings":"","what":"Log-likelihood of the size of chains with Poisson offspring distribution — pois_size_ll","title":"Log-likelihood of the size of chains with Poisson offspring distribution — pois_size_ll","text":"Log-likelihood size chains Poisson offspring distribution","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/pois_size_ll.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Log-likelihood of the size of chains with Poisson offspring distribution — pois_size_ll","text":"","code":"pois_size_ll(x, lambda)"},{"path":"https://epiverse-trace.github.io/bpmodels/reference/pois_size_ll.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Log-likelihood of the size of chains with Poisson offspring distribution — pois_size_ll","text":"x vector sizes lambda rate Poisson distribution","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/pois_size_ll.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Log-likelihood of the size of chains with Poisson offspring distribution — pois_size_ll","text":"log-likelihood values","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/pois_size_ll.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Log-likelihood of the size of chains with Poisson offspring distribution — pois_size_ll","text":"Sebastian Funk","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/rbinom_size.html","id":null,"dir":"Reference","previous_headings":"","what":"Samples size (the number of trials) of a binomial distribution — rbinom_size","title":"Samples size (the number of trials) of a binomial distribution — rbinom_size","text":"Samples size parameter binomial distribution fixed x (number successes) p (success probability)","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/rbinom_size.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Samples size (the number of trials) of a binomial distribution — rbinom_size","text":"","code":"rbinom_size(n, x, prob)"},{"path":"https://epiverse-trace.github.io/bpmodels/reference/rbinom_size.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Samples size (the number of trials) of a binomial distribution — rbinom_size","text":"n number samples generate x number successes prob probability success","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/rbinom_size.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Samples size (the number of trials) of a binomial distribution — rbinom_size","text":"sampled sizes","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/rbinom_size.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Samples size (the number of trials) of a binomial distribution — rbinom_size","text":"Sebastian Funk","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/rborel.html","id":null,"dir":"Reference","previous_headings":"","what":"Random number generator from the Borel distribution — rborel","title":"Random number generator from the Borel distribution — rborel","text":"Random numbers generated simulating Poisson branching process","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/rborel.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Random number generator from the Borel distribution — rborel","text":"","code":"rborel(n, mu, infinite = Inf)"},{"path":"https://epiverse-trace.github.io/bpmodels/reference/rborel.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Random number generator from the Borel distribution — rborel","text":"n number random variates generate. mu mu parameter (Poisson mean). infinite number treat infinite; simulations stopped number reached","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/rborel.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Random number generator from the Borel distribution — rborel","text":"vector random numbers","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/rborel.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Random number generator from the Borel distribution — rborel","text":"Sebastian Funk","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/rgen_length.html","id":null,"dir":"Reference","previous_headings":"","what":"Samples chain lengths with given observation probabilities — rgen_length","title":"Samples chain lengths with given observation probabilities — rgen_length","text":"Samples length transmission chain individual element observed binomial probability parameters n (number successes) p (success probability)","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/rgen_length.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Samples chain lengths with given observation probabilities — rgen_length","text":"","code":"rgen_length(n, x, prob)"},{"path":"https://epiverse-trace.github.io/bpmodels/reference/rgen_length.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Samples chain lengths with given observation probabilities — rgen_length","text":"n number samples generate x observed chain lengths prob probability observation","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/rgen_length.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Samples chain lengths with given observation probabilities — rgen_length","text":"sampled lengths","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/rgen_length.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Samples chain lengths with given observation probabilities — rgen_length","text":"Sebastian Funk","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/rnbinom_mean_disp.html","id":null,"dir":"Reference","previous_headings":"","what":"Negative binomial random numbers parametrized in terms of mean and dispersion coefficient — rnbinom_mean_disp","title":"Negative binomial random numbers parametrized in terms of mean and dispersion coefficient — rnbinom_mean_disp","text":"Negative binomial random numbers parametrized terms mean dispersion coefficient","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/rnbinom_mean_disp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Negative binomial random numbers parametrized in terms of mean and dispersion coefficient — rnbinom_mean_disp","text":"","code":"rnbinom_mean_disp(n, mn, disp)"},{"path":"https://epiverse-trace.github.io/bpmodels/reference/rnbinom_mean_disp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Negative binomial random numbers parametrized in terms of mean and dispersion coefficient — rnbinom_mean_disp","text":"n number samples draw mn mean distribution; Must > 0. disp dispersion coefficient (var/mean); Must > 1.","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/rnbinom_mean_disp.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Negative binomial random numbers parametrized in terms of mean and dispersion coefficient — rnbinom_mean_disp","text":"vector containing random numbers","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/rnbinom_mean_disp.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Negative binomial random numbers parametrized in terms of mean and dispersion coefficient — rnbinom_mean_disp","text":"Flavio Finger","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/reference/rnbinom_mean_disp.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Negative binomial random numbers parametrized in terms of mean and dispersion coefficient — rnbinom_mean_disp","text":"","code":"rnbinom_mean_disp(n = 5, mn = 4, disp = 2) #> [1] 8 7 6 9 6"},{"path":[]},{"path":"https://epiverse-trace.github.io/bpmodels/news/index.html","id":"unit-tests-and-input-validation-0-3-1","dir":"Changelog","previous_headings":"","what":"Unit tests and input validation","title":"bpmodels 0.3.1","text":"following internal functions now input validation: rborel(), dborel(), complementary_logprob(), rnbinom_mean_disp(). Code coverage improved tests following functions: rborel(), dborel(), chain_sim(), rnbinom_mean_disp(), complementary_logprob(), rgen_length(), rbinom_size().","code":""},{"path":[]},{"path":"https://epiverse-trace.github.io/bpmodels/news/index.html","id":"website-0-3-0","dir":"Changelog","previous_headings":"","what":"Website","title":"bpmodels 0.3.0","text":"website updated use bootstrap 5. means slightly new look. Exported functions “references” grouped topics.","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/news/index.html","id":"vignettes-0-3-0","dir":"Changelog","previous_headings":"","what":"Vignettes","title":"bpmodels 0.3.0","text":"new vignette added compile bibliography papers apply branching processes infectious disease epidemiology. “quickstart” section README moved “Getting started” section website. README now provides quick description core functions package users referred website quick start.","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/news/index.html","id":"readme-0-3-0","dir":"Changelog","previous_headings":"","what":"README","title":"bpmodels 0.3.0","text":"README longer quickstart section moved website. give README minimalistic look.","code":""},{"path":[]},{"path":"https://epiverse-trace.github.io/bpmodels/news/index.html","id":"minor-functionality-change-0-2-1","dir":"Changelog","previous_headings":"","what":"Minor functionality change","title":"bpmodels 0.2.1","text":"chain_sim() now throws warning, instead error, tree set FALSE serial also specified. assume providing serial interval means want tree transmissions simulated, chain_sim() internally sets tree = TRUE throws warning explaining happened. behaviour break simulations previous versions bpmodels, , please submit issue. remove warning, user explicitly set tree = TRUE specify serial.","code":""},{"path":[]},{"path":"https://epiverse-trace.github.io/bpmodels/news/index.html","id":"documentation-0-2-0","dir":"Changelog","previous_headings":"","what":"Documentation","title":"bpmodels 0.2.0","text":"chain_sim()’s help file updated details. particular, describe detail specify serial argument function. also added examples. new vignette describing project COVID-19 incidence chain_sim() added can accessed bpmodels website “Articles”. README’s “quick start” section updated previously introduction vignette.","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/news/index.html","id":"bpmodels-019999","dir":"Changelog","previous_headings":"","what":"bpmodels 0.1.9999","title":"bpmodels 0.1.9999","text":"faster, vectorised chain simulations","code":""},{"path":"https://epiverse-trace.github.io/bpmodels/news/index.html","id":"bpmodels-010","dir":"Changelog","previous_headings":"","what":"bpmodels 0.1.0","title":"bpmodels 0.1.0","text":"initial release","code":""}]
+[{"path":"https://epiforecasts.io/bpmodels/CONTRIBUTING.html","id":null,"dir":"","previous_headings":"","what":"Contributing to bpmodels","title":"Contributing to bpmodels","text":"outlines propose change bpmodels.","code":""},{"path":"https://epiforecasts.io/bpmodels/CONTRIBUTING.html","id":"making-changes","dir":"","previous_headings":"","what":"Making changes","title":"Contributing to bpmodels","text":"want make change, ’s good idea first file issue make sure someone team agrees ’s needed. ’ve found bug, please file issue illustrates bug minimal reprex (also help write unit test, needed). See bug report template. feature request see feature request.","code":""},{"path":"https://epiforecasts.io/bpmodels/CONTRIBUTING.html","id":"pull-request-process","dir":"","previous_headings":"Making changes","what":"Pull request process","title":"Contributing to bpmodels","text":"See pull request template Fork package clone onto computer. haven’t done , recommend using usethis::create_from_github(\"epiverse-trace/bpmodels\", fork = TRUE). Install development dependencies devtools::install_dev_deps(), make sure package passes R CMD check running devtools::check(). R CMD check doesn’t pass cleanly, ’s good idea ask help continuing. Create Git branch pull request (PR). recommend using usethis::pr_init(\"brief-description--change\"). Make changes, commit git, create PR running usethis::pr_push(), following prompts browser. title PR briefly describe change. body PR contain Fixes #issue-number. user-facing changes, add bullet top NEWS.md (.e. just first header). Follow style described https://style.tidyverse.org/news.html.","code":""},{"path":"https://epiforecasts.io/bpmodels/CONTRIBUTING.html","id":"code-style","dir":"","previous_headings":"Making changes","what":"Code style","title":"Contributing to bpmodels","text":"New code follow tidyverse style guide. can use styler package apply styles, please don’t restyle code nothing PR. use roxygen2, Markdown syntax, documentation. use testthat unit tests. Contributions test cases included easier accept.","code":""},{"path":"https://epiforecasts.io/bpmodels/CONTRIBUTING.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Contributing to bpmodels","text":"Please note bpmodels released Contributor Code Conduct. contributing project agree abide terms.","code":""},{"path":"https://epiforecasts.io/bpmodels/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2023 bpmodels authors Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://epiforecasts.io/bpmodels/articles/bpmodels.html","id":"note","dir":"Articles","previous_headings":"","what":"Note","title":"Analysing infectious disease transmission chains with bpmodels","text":"bpmodels now retired longer maintained. recommend using {epichains} instead. need help converting code use {epichains}, please open discussion epichains. bpmodels provides methods analyse simulate size length branching processes arbitrary offspring distribution. can used, example, analyse distribution chain sizes length infectious disease outbreaks, discussed Farrington, Kanaan, Gay (2003) Blumberg Lloyd-Smith (2013).","code":""},{"path":"https://epiforecasts.io/bpmodels/articles/bpmodels.html","id":"quick-start","dir":"Articles","previous_headings":"","what":"Quick start","title":"Analysing infectious disease transmission chains with bpmodels","text":"","code":"library(\"bpmodels\")"},{"path":"https://epiforecasts.io/bpmodels/articles/bpmodels.html","id":"chain_ll-calculate-log-likelihoods","dir":"Articles","previous_headings":"Quick start","what":"chain_ll(): calculate log-likelihoods","title":"Analysing infectious disease transmission chains with bpmodels","text":"chain_ll() function calculates log-likelihood distribution chain sizes lengths given offspring distribution associated parameters. example, observed distribution chains sizes \\(1, 1, 4, 7\\), can calculate log-likelihood observed chain assuming offspring per generation Poisson distributed mean number (can interpreted reproduction number, \\(R_0\\)) \\(0.5\\). , run first argument chain_ll() chain size (length, number generations chain lasted) distribution analyse. second argument, offspring, specifies offspring distribution. specified string name function used generate random offspring. can probability distribution implemented R, , one corresponding function generating random numbers beginning letter r. case example , since random Poisson numbers generated R using function called rpois(), string pass offspring argument \"pois\". third argument, stat, determines whether analyse chain sizes (\"size\", default argument specified) lengths (\"length\"). Lastly, named arguments recognised chain_ll() interpreted parameters corresponding probability distribution, lambda = 0.5 mean Poisson distribution (see R help page Poisson distribution information).","code":"chain_sizes <- c(1, 1, 4, 7) # example of observed chain sizes chain_ll(x = chain_sizes, offspring = \"pois\", stat = \"size\", lambda = 0.5) #> [1] -8.607196"},{"path":"https://epiforecasts.io/bpmodels/articles/bpmodels.html","id":"imperfect-observations","dir":"Articles","previous_headings":"Quick start > chain_ll(): calculate log-likelihoods","what":"Imperfect observations","title":"Analysing infectious disease transmission chains with bpmodels","text":"default, chain_ll() assumes perfect observation, obs_prob = 1 (See ?chain_ll), meaning transmission events observed recorded data. observations imperfect, chain_ll() provides argument, obs_prob, specifying probability observation. probability used determine likelihood observing specified chain sizes lengths. case imperfect observation, true chain sizes lengths simulated repeatedly (number times given nsim_obs argument), likelihood calculated simulations. example, probability observing case obs_prob = 0.30, use returns 10 likelihood values (nsim_obs = 10), can averaged come overall likelihood estimate. find usage chain_ll() function, can run ?chain_ll access R help file.","code":"chain_sizes <- c(1, 1, 4, 7) # example of observed chain sizes ll <- chain_ll(chain_sizes, \"pois\", \"size\", obs_prob = 0.3, lambda = 0.5, nsim_obs = 10) ll #> [1] -20.47284 -22.52364 -26.77325 -24.33340 -21.86479 -22.11361 -32.01951 #> [8] -19.77477 -22.90776 -27.59180"},{"path":"https://epiforecasts.io/bpmodels/articles/bpmodels.html","id":"how-chain_ll-works","dir":"Articles","previous_headings":"Quick start > chain_ll(): calculate log-likelihoods","what":"How chain_ll() works","title":"Analysing infectious disease transmission chains with bpmodels","text":"probability distribution chain sizes lengths analytical solution, used. chain_ll() currently supports Poisson negative binomial size distribution Poisson geometric length distribution. analytical solution exist, simulations used approximate probability distributions (using linear approximation cumulative distribution unobserved sizes/lengths). case, extra argument nsim_offspring must passed chain_ll() specify number simulations used approximation. example, get offspring drawn binomial distribution probability prob = 0.5, run","code":"set.seed(12) chain_sizes <- c(1, 1, 4, 7) # example of observed chain sizes chain_ll(chain_sizes, \"binom\", \"size\", size = 1, prob = 0.5, nsim_offspring = 100) #> [1] -8.496803"},{"path":"https://epiforecasts.io/bpmodels/articles/bpmodels.html","id":"chain_sim-simulate-transmission-chains-with-branching-processes","dir":"Articles","previous_headings":"Quick start","what":"chain_sim(): simulate transmission chains with branching processes","title":"Analysing infectious disease transmission chains with bpmodels","text":"simulate branching process, use chain_sim() function. function follows syntax chain_ll(). Note chain_sim() stochastic, seed needs set ensure results can reproduced. , simulating \\(5\\) chains, assuming offspring generated using Poisson distribution mean, lambda = 0.5. default, chain_sim() returns vector chain sizes/lengths. instead want return tree infectees infectors, need specify function serial interval set tree = TRUE (see next section).","code":"set.seed(12) chain_sim(n = 5, offspring = \"pois\", stat = \"size\", lambda = 0.5) #> [1] 1 2 4 1 1"},{"path":"https://epiforecasts.io/bpmodels/articles/bpmodels.html","id":"simulating-trees","dir":"Articles","previous_headings":"Quick start > chain_sim(): simulate transmission chains with branching processes","what":"Simulating trees","title":"Analysing infectious disease transmission chains with bpmodels","text":"simulate tree transmission chains, specify serial interval generation function (serial_interval()) set tree = TRUE follows:","code":"set.seed(12) serial_interval <- function(n) { rlnorm(n, meanlog = 0.58, sdlog = 1.58) } chains_df <- chain_sim( n = 5, offspring = \"pois\", lambda = 0.5, stat = \"length\", infinite = 100, serial = serial_interval, tree = TRUE ) head(chains_df) #> n id ancestor generation time #> 1 1 1 NA 1 0.00000000 #> 2 2 1 NA 1 0.00000000 #> 3 3 1 NA 1 0.00000000 #> 4 4 1 NA 1 0.00000000 #> 5 5 1 NA 1 0.00000000 #> 6 2 2 1 2 0.09968906"},{"path":[]},{"path":"https://epiforecasts.io/bpmodels/articles/branching_process_literature.html","id":"note","dir":"Articles","previous_headings":"","what":"Note","title":"Literature on branching process applications","text":"bpmodels now retired longer maintained. recommend using {epichains} instead. need help converting code use {epichains}, please open discussion epichains. , provide bibliography application branching processes infectious disease modelling. intention grow list serve point reference budding modellers interest subject. like extend list, easiest way file issue, listing new additions ’ll take , submit pull request updated version bibliography file found “vignettes/branching_process_literature.json”.","code":""},{"path":[]},{"path":"https://epiforecasts.io/bpmodels/articles/projecting_incidence.html","id":"note","dir":"Articles","previous_headings":"","what":"Note","title":"Projecting infectious disease incidence: a COVID-19 example","text":"bpmodels now retired longer maintained. recommend using {epichains} instead. need help converting code use {epichains}, please open discussion epichains.","code":""},{"path":"https://epiforecasts.io/bpmodels/articles/projecting_incidence.html","id":"overview","dir":"Articles","previous_headings":"Note","what":"Overview","title":"Projecting infectious disease incidence: a COVID-19 example","text":"Branching processes can used project infectious disease trends time provided can characterise distribution times symptom onset successive cases (serial interval), distribution secondary cases produced single individual (offspring distribution). simulations can achieved bpmodels chain_sim() function Pearson et al. (2020), Abbott et al. (2020) illustrate application COVID-19. purpose vignette use early data COVID-19 South Africa (Marivate Combrink 2020) illustrate bpmodels can used project incidence outbreak. Let’s load required packages","code":"library(\"bpmodels\") library(\"dplyr\") library(\"ggplot2\") library(\"lubridate\")"},{"path":"https://epiforecasts.io/bpmodels/articles/projecting_incidence.html","id":"data","dir":"Articles","previous_headings":"Note","what":"Data","title":"Projecting infectious disease incidence: a COVID-19 example","text":"Included bpmodels cleaned time series first 15 days COVID-19 outbreak South Africa. can loaded memory follows: Let us examine first 6 entries dataset.","code":"data(\"covid19_sa\", package = \"bpmodels\") head(covid19_sa) #> # A tibble: 6 × 2 #> date cases #> #> 1 2020-03-05 1 #> 2 2020-03-07 1 #> 3 2020-03-08 1 #> 4 2020-03-09 4 #> 5 2020-03-11 6 #> 6 2020-03-12 3"},{"path":[]},{"path":"https://epiforecasts.io/bpmodels/articles/projecting_incidence.html","id":"onset-times","dir":"Articles","previous_headings":"Note > Setting up the inputs","what":"Onset times","title":"Projecting infectious disease incidence: a COVID-19 example","text":"chain_sim() requires vector onset times, t0, chain/individual/simulation. covid19_sa dataset aggregated, disaggregate linelist row representing case onset time. achieve , first use date index case reference find difference date reference. Using vector start times time series, create linelist disaggregating time series case corresponding start time.","code":"days_since_index <- as.integer(covid19_sa$date - min(covid19_sa$date)) days_since_index #> [1] 0 2 3 4 6 7 8 9 10 11 12 13 14 15 start_times <- unlist(mapply( function(x, y) rep(x, times = ifelse(y == 0, 1, y)), days_since_index, covid19_sa$cases )) start_times #> [1] 0 2 3 4 4 4 4 6 6 6 6 6 6 7 7 7 8 8 8 8 8 8 8 8 9 #> [26] 9 9 9 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 10 10 #> [51] 10 11 11 11 11 11 11 11 11 11 11 11 12 12 12 12 12 12 12 12 12 12 12 12 12 #> [76] 12 12 12 12 12 12 12 12 12 12 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 #> [101] 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 14 14 14 14 14 14 14 14 14 #> [126] 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 #> [151] 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 #> [176] 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 #> [201] 15 15"},{"path":"https://epiforecasts.io/bpmodels/articles/projecting_incidence.html","id":"serial-interval","dir":"Articles","previous_headings":"Note > Setting up the inputs","what":"Serial interval","title":"Projecting infectious disease incidence: a COVID-19 example","text":"log-normal distribution commonly used epidemiology characterise quantities serial interval large variance can positive-valued (Nishiura 2007; Limpert, Stahel, Abbt 2001). example, assume based COVID-19 literature serial interval, S, log-normal distributed parameters, \\(\\mu = 4.7\\) \\(\\sigma = 2.9\\) (Pearson et al. 2020). Note distribution described way, means \\(\\mu\\) \\(\\sigma\\) expected value standard deviation natural logarithm serial interval. Hence, order sample “back-transformed” measured serial interval expectation/mean, \\(E[S]\\) standard deviation, \\(SD [S]\\), can use following parametrisation: \\[\\begin{align} E[S] &= \\ln \\left( \\dfrac{\\mu^2}{(\\sqrt{\\mu^2 + \\sigma^2}} \\right) \\\\ SD [S] &= \\sqrt {\\ln \\left(1 + \\dfrac{\\sigma^2}{\\mu^2} \\right)} \\end{align}\\] See “log-normal_distribution” Wikipedia detailed explanation parametrisation. now set serial interval function appropriate inputs. adopt R’s random lognormal distribution generator (rlnorm()) takes meanlog sdlog arguments, define parametrisation log_mean() log_sd() respectively wrap serial_interval() function. Moreover, serial_interval() takes one argument sample_size required bpmodels (See ?bpmodels::chain_sim), passed rlnorm() first argument determine number observations sample (See ?rlnorm).","code":"mu <- 4.7 sgma <- 2.9 log_mean <- log((mu^2) / (sqrt(sgma^2 + mu^2))) # log mean log_sd <- sqrt(log(1 + (sgma / mu)^2)) # log sd #' serial interval function serial_interval <- function(sample_size) { si <- rlnorm(sample_size, meanlog = log_mean, sdlog = log_sd) return(si) }"},{"path":"https://epiforecasts.io/bpmodels/articles/projecting_incidence.html","id":"offspring-distribution","dir":"Articles","previous_headings":"Note > Setting up the inputs","what":"Offspring distribution","title":"Projecting infectious disease incidence: a COVID-19 example","text":"negative binomial distribution commonly used epidemiology account individual variation transmissibility, also known superspreading (Lloyd-Smith et al. 2005). example, assume offspring distribution characterised negative binomial \\(R = 2.5\\) (Abbott et al. 2020) \\(k = 0.58\\) (Wang et al. 2020). parameterization, \\(R\\) represents \\(R_0\\), defined average number cases produced single individual entirely susceptible population. parameter \\(k\\) represents superspreading, , degree heterogeneity transmission single individuals.","code":""},{"path":"https://epiforecasts.io/bpmodels/articles/projecting_incidence.html","id":"simulation-controls","dir":"Articles","previous_headings":"Note > Setting up the inputs","what":"Simulation controls","title":"Projecting infectious disease incidence: a COVID-19 example","text":"chain_sim() also requires end time simulations. example, simulate outbreaks end 14 days last date observations covid19_sa. chain_sim() stochastic, meaning results different every time run set parameters, run simulations many times summarise results. , therefore, run simulation \\(100\\) times.","code":"#' Date to end simulation (14 day projection in this case) projection_window <- 14 # 14 days/ 2-week ahead projection projection_end_day <- max(days_since_index) + projection_window projection_end_day #> [1] 29 #' Number of simulations sim_rep <- 100"},{"path":"https://epiforecasts.io/bpmodels/articles/projecting_incidence.html","id":"modelling-assumptions","dir":"Articles","previous_headings":"Note","what":"Modelling assumptions","title":"Projecting infectious disease incidence: a COVID-19 example","text":"chain_sim() makes following simplifying assumptions: cases observed reporting delay Reporting rate constant course epidemic interventions implemented Population homogeneous well-mixed cases start chains transmission proceed independently without competition depletion susceptibles. implies none cases seen far infected . summarise whole set far, going simulate chain 100 times, projecting COVID-19 cases 14 days first \\(15\\) days.","code":""},{"path":"https://epiforecasts.io/bpmodels/articles/projecting_incidence.html","id":"running-the-simulations","dir":"Articles","previous_headings":"Note","what":"Running the simulations","title":"Projecting infectious disease incidence: a COVID-19 example","text":"use function lapply() run simulations bind rows dplyr::bind_rows(). Let us view first rows simulation results.","code":"set.seed(1234) sim_chain_sizes <- lapply( seq_len(sim_rep), function(sim) { chain_sim( n = length(start_times), offspring = \"nbinom\", mu = 2.5, size = 0.58, stat = \"size\", serial = serial_interval, t0 = start_times, tf = projection_end_day, tree = TRUE ) %>% mutate(sim = sim) } ) sim_output <- bind_rows(sim_chain_sizes) head(sim_output) #> n id ancestor generation time sim #> 1 1 1 NA 1 0 1 #> 2 2 1 NA 1 2 1 #> 3 3 1 NA 1 3 1 #> 4 4 1 NA 1 4 1 #> 5 5 1 NA 1 4 1 #> 6 6 1 NA 1 4 1"},{"path":"https://epiforecasts.io/bpmodels/articles/projecting_incidence.html","id":"post-processing","dir":"Articles","previous_headings":"Note","what":"Post-processing","title":"Projecting infectious disease incidence: a COVID-19 example","text":"Now, summarise simulation results. want plot individual simulated daily time series show median cases per day aggregated simulations. First, create daily time series per simulation aggregating number cases per day simulation. Next, add date column results simulation set. use date first case observed data reference start date. Now aggregate simulations day evaluate median daily cases across simulations.","code":"# Daily number of cases for each simulation incidence_ts <- sim_output %>% mutate(day = ceiling(time)) %>% group_by(sim, day) %>% summarise(cases = n()) %>% ungroup() head(incidence_ts) #> # A tibble: 6 × 3 #> sim day cases #> #> 1 1 0 1 #> 2 1 2 1 #> 3 1 3 1 #> 4 1 4 4 #> 5 1 6 6 #> 6 1 7 4 # Get start date from the observed data index_date <- min(covid19_sa$date) index_date #> [1] \"2020-03-05\" # Add a dates column to each simulation result incidence_ts_by_date <- incidence_ts %>% group_by(sim) %>% mutate(date = index_date + days(seq(0, n() - 1))) %>% ungroup() head(incidence_ts_by_date) #> # A tibble: 6 × 4 #> sim day cases date #> #> 1 1 0 1 2020-03-05 #> 2 1 2 1 2020-03-06 #> 3 1 3 1 2020-03-07 #> 4 1 4 4 2020-03-08 #> 5 1 6 6 2020-03-09 #> 6 1 7 4 2020-03-10 # Median daily number of cases aggregated across all simulations median_daily_cases <- incidence_ts_by_date %>% group_by(date) %>% summarise(median_cases = median(cases)) %>% ungroup() %>% arrange(date) head(median_daily_cases) #> # A tibble: 6 × 2 #> date median_cases #> #> 1 2020-03-05 1 #> 2 2020-03-06 1 #> 3 2020-03-07 1 #> 4 2020-03-08 4 #> 5 2020-03-09 4 #> 6 2020-03-10 8"},{"path":"https://epiforecasts.io/bpmodels/articles/projecting_incidence.html","id":"visualization","dir":"Articles","previous_headings":"Note","what":"Visualization","title":"Projecting infectious disease incidence: a COVID-19 example","text":"now plot individual simulation results alongside median aggregated results. Figure 1: COVID-19 incidence South Africa projected two week window 2020. light gray lines represent individual simulations, red line represents median daily cases across simulations, black connected dots represent observed data, dashed vertical line marks beginning projection.","code":"## since all simulations may end at a different date, we will find the minimum ## final date for all simulations for the purposes of visualisation final_date <- incidence_ts_by_date %>% group_by(sim) %>% summarise(final_date = max(date), .groups = \"drop\") %>% summarise(min_final_date = min(final_date)) %>% pull(min_final_date) incidence_ts_by_date <- incidence_ts_by_date %>% filter(date <= final_date) median_daily_cases <- median_daily_cases %>% filter(date <= final_date) ggplot(data = incidence_ts_by_date) + geom_line( aes( x = date, y = cases, group = sim ), color = \"grey\", linewidth = 0.2, alpha = 0.25 ) + geom_line( data = median_daily_cases, aes( x = date, y = median_cases ), color = \"tomato3\", linewidth = 1.8 ) + geom_point( data = covid19_sa, aes( x = date, y = cases ), color = \"black\", size = 1.75, shape = 21 ) + geom_line( data = covid19_sa, aes( x = date, y = cases ), color = \"black\", linewidth = 1 ) + scale_x_continuous( breaks = seq( min(incidence_ts_by_date$date), max(incidence_ts_by_date$date), 5 ), labels = seq( min(incidence_ts_by_date$date), max(incidence_ts_by_date$date), 5 ) ) + scale_y_continuous( breaks = seq( 0, max(incidence_ts_by_date$cases) + 200, 250 ), labels = seq( 0, max(incidence_ts_by_date$cases) + 200, 250 ) ) + geom_vline( mapping = aes(xintercept = max(covid19_sa$date)), linetype = \"dashed\" ) + labs(x = \"Date\", y = \"Daily cases\")"},{"path":[]},{"path":"https://epiforecasts.io/bpmodels/articles/theoretical_background.html","id":"note","dir":"Articles","previous_headings":"","what":"Note","title":"Theoretical background for bpmodels","text":"bpmodels now retired longer maintained. recommend using {epichains} instead. need help converting code use {epichains}, please open discussion epichains. bpmodels provides methods analyse simulate size length branching processes arbitrary offspring distribution. vignette lay mathematical concepts behind functionality available package.","code":""},{"path":"https://epiforecasts.io/bpmodels/articles/theoretical_background.html","id":"branching-processes","dir":"Articles","previous_headings":"","what":"Branching processes","title":"Theoretical background for bpmodels","text":"Branching processes class models used model growth populations. assume member population produces number offspring, \\(Z\\), random variable probability mass function \\(p(Z = z | \\theta)\\), called offspring distribution. use long history epidemiology, population interpreted pathogen, offspring new hosts infects (Farrington, Kanaan, Gay 2003). call infected individuals cases methods applied contexts branching processes used.","code":""},{"path":"https://epiforecasts.io/bpmodels/articles/theoretical_background.html","id":"simulation","dir":"Articles","previous_headings":"","what":"Simulation","title":"Theoretical background for bpmodels","text":"simulate branching process, start single case proceed discrete steps generations, drawing offspring distribution \\(p(Z=z | \\theta)\\) generate new cases case. Given infector \\(\\) infectee \\(j\\), can additionally assign distribution times \\(T\\) approximates infection event occurred. define \\(T\\) random variable distribution \\(f(T = t; \\theta)\\) can assign case \\(j\\) time \\(t_{j}\\) , case \\(j\\) affected case \\(\\) given \\(f(t_{j} - t_{} | \\theta)\\). identify timing cases time symptom onset serial interval, depending case definitions another interval.","code":""},{"path":"https://epiforecasts.io/bpmodels/articles/theoretical_background.html","id":"summary-statistics","dir":"Articles","previous_headings":"Simulation","what":"Summary statistics","title":"Theoretical background for bpmodels","text":"Branching process simulations end gone extinct, , offspring produced, stopping criterion. summarise simulations, either study size length resulting chain cases. size \\(S\\) chain number cases occurred course simulation including initial case \\(S \\geq 1\\). length \\(L\\) chain number generations simulated including initial case \\(L \\geq 1\\).","code":""},{"path":"https://epiforecasts.io/bpmodels/articles/theoretical_background.html","id":"inference","dir":"Articles","previous_headings":"","what":"Inference","title":"Theoretical background for bpmodels","text":"characterising chains cases size length can conduct inference learn underlying parameters \\(\\theta\\) observation chain sizes chain lengths (Blumberg Lloyd-Smith 2013). general possible subcritical branching processes, .e. ones mean number offspring less 1, otherwise branching process grow forever. However, can expand theory supercritical branching processes, .e. ones mean number offspring greater 1, defining cutoff chain size length beyond treat chain infinite size length, respectively.","code":""},{"path":"https://epiforecasts.io/bpmodels/articles/theoretical_background.html","id":"size-and-length-distributions-for-some-offspring-distributions","dir":"Articles","previous_headings":"Inference","what":"Size and length distributions for some offspring distributions","title":"Theoretical background for bpmodels","text":"show equations size length distributions offspring distributions can derived analytically: Poisson, negative binomial, geometric, gamma-Borel mixture.","code":""},{"path":"https://epiforecasts.io/bpmodels/articles/theoretical_background.html","id":"negative-binomial-and-special-cases","dir":"Articles","previous_headings":"Inference > Size and length distributions for some offspring distributions","what":"Negative binomial and special cases","title":"Theoretical background for bpmodels","text":"offspring distribution Poisson distribution, can interpret rate parameter \\(\\lambda\\) basic reproduction number \\(R_{0}\\) pathogen. general case offspring definition can overdispersed leading superspreading can use negative binomial offspring distribution mean \\(\\mu\\) overdispersion \\(k\\) Blumberg Lloyd-Smith (2013). case, mean parameter \\(\\mu\\) interpreted basic reproduction number \\(R_0\\) pathogen. negative binomial distribution arises Poisson-gamma mixture thus branching process negative binomial distributed offspring can interpreted one Poisson distributed offspring basic reproduction number \\(R_0\\) varies according gamma distribution. amount variation \\(R_0\\) interpreted individual-level variation transmission representing overdispersion superspreading, degree happens given overdispersion parameter \\(k\\).","code":""},{"path":"https://epiforecasts.io/bpmodels/articles/theoretical_background.html","id":"size-distributions","dir":"Articles","previous_headings":"Inference > Size and length distributions for some offspring distributions > Negative binomial and special cases","what":"Size distributions","title":"Theoretical background for bpmodels","text":"probability \\(p\\) chain size \\(S\\) given \\(R_0\\) \\(k\\) branching process negative binomial offspring distribution given Eq. 9 Blumberg Lloyd-Smith (2013) \\[ p(S|R_0, k) = \\frac{\\Gamma(kS + S - 1)}{\\Gamma(kS)\\Gamma(S + 1)} \\frac{\\left(\\frac{R_0}{k}\\right)^{S - 1}}{\\left( 1 + \\frac{R_0}{k} \\right)^{kS + S - 1}} \\] \\(\\Gamma\\) gamma function. order estimate \\(S\\) given \\(R_0\\) \\(k\\) can define likelihood function \\(L(S) = p(S|R_0, k)\\). corresponding log-likelihood \\[\\begin{align} \\mathrm{LL}(S) = &\\log\\Gamma(kS + S - 1) - \\left(\\log\\Gamma(kS) + \\log\\Gamma(S - 1) \\right) \\\\ & + (S-1) \\log \\frac{R_0}{k} - (SR_0 + (S - 1)) \\log \\left(1 + \\frac{R_0}{k}\\right) \\end{align}\\] log-likelihood Poisson distributed offspring follows \\(k\\) tends infinity (corresponding Eq. 2.2 Farrington, Kanaan, Gay (2003)) \\[ \\mathrm{LL}(S) = (S - 1) \\log R_0 - S R_0 + (S - 2) \\log S - \\log\\Gamma(S) \\] cases point estimate basic reproduction number \\(\\hat{R_0}\\) related mean chain size \\(\\bar{S}\\) \\[ \\hat{R_0} = 1 - \\frac{1}{\\bar{S}} \\]","code":""},{"path":"https://epiforecasts.io/bpmodels/articles/theoretical_background.html","id":"length-distributions","dir":"Articles","previous_headings":"Inference > Size and length distributions for some offspring distributions > Negative binomial and special cases","what":"Length distributions","title":"Theoretical background for bpmodels","text":"cumulative mass function \\(F(L)\\) observing chain length \\(L\\) offspring Poisson distributed given Eq. (2.5) Farrington, Kanaan, Gay (2003) (called “outbreak duration”): \\[ F(L) = e^{-R_0} E_L \\left( e^{R_0 e^{-R_0} } \\right) \\] \\(E_L(x)\\) iterated exponential function, \\(E_0(x) = 1\\), \\(E_{L + 1}(x) = x^{E_L(x)}\\). geometric distributed offspring (corresponding negative Binomial \\(k=1\\)) function given \\[ F(L) = \\frac{ 1- R_0^{L + 1} } {1 - R_0^{L - 2}} \\] cases \\(f(L)\\) denotes cumulative mass functions therefore probability observing chain length \\(L\\) therefore \\(f(L) - f(L - 1)\\).","code":""},{"path":"https://epiforecasts.io/bpmodels/articles/theoretical_background.html","id":"gamma-borel-mixture","dir":"Articles","previous_headings":"Inference > Size and length distributions for some offspring distributions","what":"Gamma-Borel mixture","title":"Theoretical background for bpmodels","text":"probability distribution outbreak sizes branching process Poisson offspring distribution (Eq. 2.2 Farrington, Kanaan, Gay (2003)) special case Borel-Tanner distribution starting 1 individual. alternative negative binomial offspring distribution represents Poisson-gamma mixture Borel-gamma mixture. represent situations variation individual level chain level, .e. transmission chains homogeneous heterogeneity chains. case, can shown resulting log-likelihood chain sizes \\[\\begin{align} \\mathrm{LL}(S) = &\\log\\Gamma(k + S - 1) - \\left(\\log\\Gamma(k) + \\log\\Gamma(S + 1) \\right) \\\\ & + (S-1) \\log S - k \\log \\left(S + \\frac{R_0}{k}\\right) \\end{align}\\]","code":""},{"path":"https://epiforecasts.io/bpmodels/articles/theoretical_background.html","id":"numerical-approximations-of-chain-size-and-length-distributions","dir":"Articles","previous_headings":"Inference","what":"Numerical approximations of chain size and length distributions","title":"Theoretical background for bpmodels","text":"analytic likelihoods available numerical approximation used derive distributions. order , simulation functionality used generate \\(n\\) simulated chains value cumulative mass function \\(P(S|\\theta)\\) observed \\(S\\) approximated empirical cumulative distribution function: \\[ P(S|\\theta) \\approx \\sum_i \\mathbf{1}(x_i <= S) \\] \\(\\mathbf{1}\\) indicator function \\(x_i\\) -th observed chain size (length, interest \\(L\\)). order improve approximation linear approximation applied values empirical distribution function (expense normalisation 1). (unnormalised) probability observing \\(S\\) given \\[ p(S|\\theta) = P(S|\\theta) - P(S - 1|\\theta) \\] equivalent relationship used \\(L\\).","code":""},{"path":"https://epiforecasts.io/bpmodels/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"James M. Azam. Author, maintainer. Zhian N. Kamvar. Contributor. Flavio Finger. Author. Sebastian Funk. Author, copyright holder. Joshua W. Lambert. Reviewer. Pratik Gupte. Reviewer. Hugo Gruson. Reviewer.","code":""},{"path":"https://epiforecasts.io/bpmodels/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Sebastian Funk, Flavio Finger, James M. Azam (2023). bpmodels: Analysing transmission chain statistics using branching process models, website: https://github.com/epiverse-trace/bpmodels/","code":"@Manual{, title = {bpmodels: Analysing transmission chain statistics using branching process models}, author = {{Sebastian Funk} and {Flavio Finger} and {James M. Azam}}, year = {2023}, url = {https://github.com/epiverse-trace/bpmodels/}, }"},{"path":[]},{"path":"https://epiforecasts.io/bpmodels/index.html","id":"note","dir":"","previous_headings":"","what":"Note","title":"Simulating and Analysing Transmission Chain Statistics using Branching Process Models","text":"bpmodels now retired longer maintained. recommend using {epichains} instead. need help converting code use {epichains}, please open discussion epichains. bpmodels R package simulate analyse size length branching processes given offspring distribution. models often used infectious disease epidemiology, chains represent chains transmission, offspring distribution represents distribution secondary infections caused infected individual.","code":""},{"path":"https://epiforecasts.io/bpmodels/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Simulating and Analysing Transmission Chain Statistics using Branching Process Models","text":"latest development version bpmodels package can installed via load package, use","code":"# check whether {pak} is installed if (!require(\"pak\")) install.packages(\"pak\") pak::pkg_install(\"epiforecasts/bpmodels\") library(\"bpmodels\") #> Note: bpmodels is now retired and replaced by epichains. All features from bpmodels are available in epichains. Get epichains from .Thank you for your support!"},{"path":"https://epiforecasts.io/bpmodels/index.html","id":"core-functionality","dir":"","previous_headings":"","what":"Core functionality","title":"Simulating and Analysing Transmission Chain Statistics using Branching Process Models","text":"bpmodels provides three main functions: chain_ll(): calculates likelihoods observing vector chains given sizes lengths. quick example estimating loglikelihood observed chain: chain_sim(): simulates transmission chains chains stop producing offspring. quick example simulate chain sizes 5 chains poisson offspring mean, lambda = 0.5: chain_sim_susc(): simulates transmission chains specified population size pre-existing immunity susceptible pool runs . quick example simulate chains poisson offspring mean, lambda = 0.5, serial interval 3: See “Get started vignette” detailed illustration function.","code":"# example of observed chain sizes chain_sizes <- c(1, 2, 3, 4) # estimate loglikelihood of the observed chain sizes chain_ll_eg <- chain_ll(x = chain_sizes, offspring = \"pois\", stat = \"size\", lambda = 0.5) chain_ll_eg #> [1] -7.772589 set.seed(123) chain_sim_eg <- chain_sim(n = 5, offspring = \"pois\", stat = \"size\", lambda = 0.5, tree = TRUE) head(chain_sim_eg) #> n id ancestor generation #> 1 1 1 NA 1 #> 2 2 1 NA 1 #> 3 3 1 NA 1 #> 4 4 1 NA 1 #> 5 5 1 NA 1 #> 6 2 2 1 2 set.seed(1234) chain_sim_susc_eg <- chain_sim_susc(pop = 1000, offspring = \"pois\", mn_offspring = 0.5, serial = function(x) {3} ) head(chain_sim_susc_eg) #> id ancestor generation time #> 1 1 NA 1 0"},{"path":"https://epiforecasts.io/bpmodels/index.html","id":"package-vignettes","dir":"","previous_headings":"","what":"Package vignettes","title":"Simulating and Analysing Transmission Chain Statistics using Branching Process Models","text":"Specific use cases bpmodels can found online documentation package vignettes, “Articles”.","code":""},{"path":"https://epiforecasts.io/bpmodels/index.html","id":"reporting-bugs","dir":"","previous_headings":"","what":"Reporting bugs","title":"Simulating and Analysing Transmission Chain Statistics using Branching Process Models","text":"report bug please open issue.","code":""},{"path":"https://epiforecasts.io/bpmodels/index.html","id":"contribute","dir":"","previous_headings":"","what":"Contribute","title":"Simulating and Analysing Transmission Chain Statistics using Branching Process Models","text":"welcome contributions enhance package’s functionalities. wish , please follow package contributing guide.","code":""},{"path":"https://epiforecasts.io/bpmodels/index.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of conduct","title":"Simulating and Analysing Transmission Chain Statistics using Branching Process Models","text":"Please note bpmodels project released Contributor Code Conduct. contributing project, agree abide terms.","code":""},{"path":"https://epiforecasts.io/bpmodels/index.html","id":"citing-this-package","dir":"","previous_headings":"","what":"Citing this package","title":"Simulating and Analysing Transmission Chain Statistics using Branching Process Models","text":"","code":"citation(\"bpmodels\") #> To cite package bpmodels in publications use: #> #> Sebastian Funk, Flavio Finger, and James M. Azam (2023). bpmodels: #> Analysing transmission chain statistics using branching process #> models, website: https://github.com/epiverse-trace/bpmodels/ #> #> A BibTeX entry for LaTeX users is #> #> @Manual{, #> title = {bpmodels: Analysing transmission chain statistics using branching process models}, #> author = {{Sebastian Funk} and {Flavio Finger} and {James M. Azam}}, #> year = {2023}, #> url = {https://github.com/epiverse-trace/bpmodels/}, #> }"},{"path":"https://epiforecasts.io/bpmodels/reference/bpmodels-package.html","id":null,"dir":"Reference","previous_headings":"","what":"bpmodels: Simulating and Analysing Transmission Chain Statistics using Branching Process Models — bpmodels-package","title":"bpmodels: Simulating and Analysing Transmission Chain Statistics using Branching Process Models — bpmodels-package","text":"Provides methods simulate analyse size length branching processes arbitrary offspring distribution. can used, example, analyse distribution chain sizes length infectious disease outbreaks, discussed Farrington et al. (2003) doi:10.1093/biostatistics/4.2.279 .","code":""},{"path":[]},{"path":"https://epiforecasts.io/bpmodels/reference/bpmodels-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"bpmodels: Simulating and Analysing Transmission Chain Statistics using Branching Process Models — bpmodels-package","text":"Maintainer: James M. Azam james.azam@lshtm.ac.uk (ORCID) Authors: Flavio Finger flavio.finger@epicentre.msf.org (ORCID) Sebastian Funk sebastian.funk@lshtm.ac.uk (ORCID) [copyright holder] contributors: Zhian N. Kamvar zkamvar@gmail.com (ORCID) [contributor]","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/chain_ll.html","id":null,"dir":"Reference","previous_headings":"","what":"Calculate the log-likelihood for the outcome of a branching process — chain_ll","title":"Calculate the log-likelihood for the outcome of a branching process — chain_ll","text":"Calculate log-likelihood outcome branching process","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/chain_ll.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Calculate the log-likelihood for the outcome of a branching process — chain_ll","text":"","code":"chain_ll( x, offspring, stat = c(\"size\", \"length\"), obs_prob = 1, infinite = Inf, exclude = NULL, individual = FALSE, nsim_obs, ... )"},{"path":"https://epiforecasts.io/bpmodels/reference/chain_ll.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Calculate the log-likelihood for the outcome of a branching process — chain_ll","text":"x vector sizes lengths transmission chains offspring Offspring distribution: character string corresponding R distribution function (e.g., \"pois\" Poisson, rpois R function generate Poisson random numbers) stat statistic given x (\"size\" \"length\" chains) obs_prob observation probability (assumed constant) infinite chains size/length treated infinite exclude sizes/lengths exclude log-likelihood calculation individual TRUE, vector individual log-likelihood contributions returned rather sum nsim_obs number simulations log-likelihood approximated imperfect observations ... parameters offspring distribution","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/chain_ll.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Calculate the log-likelihood for the outcome of a branching process — chain_ll","text":"log-likelihood, vector log-likelihoods (obs_prob < 1), list individual log-likelihood contributions (individual=TRUE)","code":""},{"path":[]},{"path":"https://epiforecasts.io/bpmodels/reference/chain_ll.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Calculate the log-likelihood for the outcome of a branching process — chain_ll","text":"Sebastian Funk","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/chain_ll.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Calculate the log-likelihood for the outcome of a branching process — chain_ll","text":"","code":"chain_sizes <- c(1, 1, 4, 7) # example of observed chain sizes chain_ll(chain_sizes, \"pois\", \"size\", lambda = 0.5) #> [1] -8.607196"},{"path":"https://epiforecasts.io/bpmodels/reference/chain_sim.html","id":null,"dir":"Reference","previous_headings":"","what":"Simulate transmission chains using a branching process — chain_sim","title":"Simulate transmission chains using a branching process — chain_sim","text":"chain_sim() stochastic simulator generating transmission chain data key inputs offspring distribution serial interval distribution.","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/chain_sim.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Simulate transmission chains using a branching process — chain_sim","text":"","code":"chain_sim( n, offspring, stat = c(\"size\", \"length\"), infinite = Inf, tree = FALSE, serial, t0 = 0, tf = Inf, ... )"},{"path":"https://epiforecasts.io/bpmodels/reference/chain_sim.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Simulate transmission chains using a branching process — chain_sim","text":"n Number simulations run. offspring Offspring distribution: character string corresponding R distribution function (e.g., \"pois\" Poisson, rpois R function generate Poisson random numbers) stat String; Statistic calculate. Can one : \"size\": total number offspring. \"length\": total number ancestors. infinite size length simulation results set Inf. Defaults Inf, resulting results ever set Inf tree Logical. transmission tree returned? Defaults FALSE. serial serial interval generator function; name user-defined named anonymous function one argument n, representing number serial intervals generate. t0 Start time (serial interval given); either single value vector length n (number simulations) initial times. Defaults 0. tf End time (serial interval given). ... Parameters offspring distribution required R.","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/chain_sim.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Simulate transmission chains using a branching process — chain_sim","text":"Either: vector sizes/lengths (tree == FALSE serial interval function specified, since implies tree == FALSE), data frame columns n (simulation ID), time (serial interval given) (tree == TRUE), id (unique ID within simulation individual element chain), ancestor (ID ancestor element), generation.","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/chain_sim.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Simulate transmission chains using a branching process — chain_sim","text":"chain_sim() either returns vector data.frame. output either vector serial provided, automatically sets tree = FALSE, data.frame, means serial provided function. serial provided, means tree = TRUE automatically. However, setting tree = TRUE require providing function serial.","code":""},{"path":[]},{"path":"https://epiforecasts.io/bpmodels/reference/chain_sim.html","id":"assumptions-disambiguation","dir":"Reference","previous_headings":"","what":"Assumptions/disambiguation","title":"Simulate transmission chains using a branching process — chain_sim","text":"epidemiology, generation interval duration successive infectious events chain transmission. Similarly, serial interval duration observed symptom onset times successive cases transmission chain. generation interval often hard observe exact times infection hard measure hence, serial interval often used instead. , use serial interval represent normally called generation interval, , time successive cases.","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/chain_sim.html","id":"specifying-serial-in-chain-sim-","dir":"Reference","previous_headings":"","what":"Specifying serial in chain_sim()","title":"Simulate transmission chains using a branching process — chain_sim","text":"serial must specified named anonymous/inline/unnamed function # nolint one argument. serial specified, chain_sim() returns times infection column output. Moreover, specifying function serial implies tree = TRUE tree infectors (ancestor) infectees (id) generated output. example, assuming want specify serial interval generator random log-normally distributed variable meanlog = 0.58 sdlog = 1.58, define named function, call \"serial_interval\", one argument representing number serial intervals sample: serial_interval <- function(n){rlnorm(n, 0.58, 1.38)}, assign name function serial chain_sim() like chain_sim(..., serial = serial_interval), ... arguments chain_sim(). Alternatively, assign anonymous function serial chain_sim() call like chain_sim(..., serial = function(n){rlnorm(n, 0.58, 1.38)}), ... arguments chain_sim().","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/chain_sim.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Simulate transmission chains using a branching process — chain_sim","text":"Sebastian Funk, James M. Azam","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/chain_sim.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Simulate transmission chains using a branching process — chain_sim","text":"","code":"# Specifying no `serial` and `tree == FALSE` (default) returns a vector set.seed(123) chain_sim(n = 5, offspring = \"pois\", stat = \"size\", lambda = 0.5, tree = FALSE) #> [1] 1 2 1 2 4 # Specifying `serial` without specifying `tree` will set `tree = TRUE` # internally. # We'll first define the serial function set.seed(123) serial_interval <- function(n) { rlnorm(n, meanlog = 0.58, sdlog = 1.58) } chain_sim( n = 5, offspring = \"pois\", lambda = 0.5, stat = \"length\", infinite = 100, serial = serial_interval ) #> n id ancestor generation time #> 1 1 1 NA 1 0.0000000 #> 2 2 1 NA 1 0.0000000 #> 3 3 1 NA 1 0.0000000 #> 4 4 1 NA 1 0.0000000 #> 5 5 1 NA 1 0.0000000 #> 6 2 2 1 2 0.1237492 #> 7 4 2 1 2 12.6594440 #> 8 5 2 1 2 1.5035572 #> 9 5 3 1 2 1.4840246 #> 10 5 4 2 3 1.6201477 #> 11 5 5 4 4 13.9750044 #> 12 5 6 4 4 4.7736253 #> 13 5 7 5 5 16.1023578 #> 14 5 8 6 5 5.5157567 #> 15 5 9 7 6 20.0243658 #> 16 5 10 7 6 16.1822358 #> 17 5 11 8 6 10.9251791 # Specifying `serial` and `tree = FALSE` will throw a warning saying that # `tree` was set to `TRUE` internally. set.seed(123) if (FALSE) { try(chain_sim( n = 10, serial = function(x) 3, offspring = \"pois\", lambda = 2, infinite = 10, tree = FALSE )) }"},{"path":"https://epiforecasts.io/bpmodels/reference/chain_sim_susc.html","id":null,"dir":"Reference","previous_headings":"","what":"Simulate a single chain using a branching process while accounting for depletion of susceptibles. — chain_sim_susc","title":"Simulate a single chain using a branching process while accounting for depletion of susceptibles. — chain_sim_susc","text":"Simulate single chain using branching process accounting depletion susceptibles.","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/chain_sim_susc.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Simulate a single chain using a branching process while accounting for depletion of susceptibles. — chain_sim_susc","text":"","code":"chain_sim_susc( offspring = c(\"pois\", \"nbinom\"), mn_offspring, disp_offspring, serial, t0 = 0, tf = Inf, pop, initial_immune = 0 )"},{"path":"https://epiforecasts.io/bpmodels/reference/chain_sim_susc.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Simulate a single chain using a branching process while accounting for depletion of susceptibles. — chain_sim_susc","text":"offspring offspring distribution: character string corresponding R distribution function. Currently \"pois\" & \"nbinom\" supported. Internally truncated distributions used avoid infecting people susceptibles available. mn_offspring average number secondary cases case disp_offspring dispersion coefficient (var/mean) number secondary cases. Ignored offspring == \"pois\". Must > 1. serial serial interval. function takes one parameter (n), number serial intervals randomly sample. Value must >= 0. t0 start time tf end time pop population initial_immune number initial immunes population","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/chain_sim_susc.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Simulate a single chain using a branching process while accounting for depletion of susceptibles. — chain_sim_susc","text":"data frame columns time, id (unique ID individual element chain), ancestor (ID ancestor element), generation.","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/chain_sim_susc.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Simulate a single chain using a branching process while accounting for depletion of susceptibles. — chain_sim_susc","text":"function couple key differences chain_sim: can simulate one chain time, can handle implemented offspring distributions (\"pois\" \"nbinom\"), always tracks returns data frame containing entire tree, maximal length chains limited pop instead infinite.","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/chain_sim_susc.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Simulate a single chain using a branching process while accounting for depletion of susceptibles. — chain_sim_susc","text":"Flavio Finger","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/chain_sim_susc.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Simulate a single chain using a branching process while accounting for depletion of susceptibles. — chain_sim_susc","text":"","code":"chain_sim_susc(\"pois\", mn_offspring = 0.5, serial = function(x) 3, pop = 100) #> id ancestor generation time #> 1 1 NA 1 0"},{"path":"https://epiforecasts.io/bpmodels/reference/complementary_logprob.html","id":null,"dir":"Reference","previous_headings":"","what":"Calculates the complementary log-probability — complementary_logprob","title":"Calculates the complementary log-probability — complementary_logprob","text":"Given x norm, calculates log(1-sum(exp(x)))","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/complementary_logprob.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Calculates the complementary log-probability — complementary_logprob","text":"","code":"complementary_logprob(x)"},{"path":"https://epiforecasts.io/bpmodels/reference/complementary_logprob.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Calculates the complementary log-probability — complementary_logprob","text":"x log-probabilities","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/complementary_logprob.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Calculates the complementary log-probability — complementary_logprob","text":"value","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/complementary_logprob.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Calculates the complementary log-probability — complementary_logprob","text":"Sebastian Funk","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/covid19_sa.html","id":null,"dir":"Reference","previous_headings":"","what":"COVID-19 Data Repository for South Africa — covid19_sa","title":"COVID-19 Data Repository for South Africa — covid19_sa","text":"aggregated subset COVID-19 Data Repository South Africa created, maintained hosted Data Science Social Impact research group, led Dr. Vukosi Marivate.","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/covid19_sa.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"COVID-19 Data Repository for South Africa — covid19_sa","text":"","code":"covid19_sa"},{"path":[]},{"path":"https://epiforecasts.io/bpmodels/reference/covid19_sa.html","id":"covid-sa","dir":"Reference","previous_headings":"","what":"covid19_sa","title":"COVID-19 Data Repository for South Africa — covid19_sa","text":"data frame 19 rows 2 columns: date Date case reported cases Number cases","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/covid19_sa.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"COVID-19 Data Repository for South Africa — covid19_sa","text":"https://github.com/dsfsi/covid19za details data-raw/covid19_sa.R.","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/covid19_sa.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"COVID-19 Data Repository for South Africa — covid19_sa","text":"data originally provided linelist subsetted cleaned data-raw/covid19_sa.R.","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/dborel.html","id":null,"dir":"Reference","previous_headings":"","what":"Density of the Borel distribution — dborel","title":"Density of the Borel distribution — dborel","text":"Density Borel distribution","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/dborel.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Density of the Borel distribution — dborel","text":"","code":"dborel(x, mu, log = FALSE)"},{"path":"https://epiforecasts.io/bpmodels/reference/dborel.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Density of the Borel distribution — dborel","text":"x vector quantiles; integer. mu mu parameter (poisson mean); non-negative. log logical; TRUE, probabilities p given log(p).","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/dborel.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Density of the Borel distribution — dborel","text":"probability mass.","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/dborel.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Density of the Borel distribution — dborel","text":"Sebastian Funk","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/gborel_size_ll.html","id":null,"dir":"Reference","previous_headings":"","what":"Log-likelihood of the size of chains with gamma-Borel offspring distribution — gborel_size_ll","title":"Log-likelihood of the size of chains with gamma-Borel offspring distribution — gborel_size_ll","text":"Log-likelihood size chains gamma-Borel offspring distribution","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/gborel_size_ll.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Log-likelihood of the size of chains with gamma-Borel offspring distribution — gborel_size_ll","text":"","code":"gborel_size_ll(x, size, prob, mu)"},{"path":"https://epiforecasts.io/bpmodels/reference/gborel_size_ll.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Log-likelihood of the size of chains with gamma-Borel offspring distribution — gborel_size_ll","text":"x vector sizes size dispersion parameter (often called k ecological applications) prob probability success (parameterisation prob, see also NegBinomial) mu mean parameter","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/gborel_size_ll.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Log-likelihood of the size of chains with gamma-Borel offspring distribution — gborel_size_ll","text":"log-likelihood values","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/gborel_size_ll.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Log-likelihood of the size of chains with gamma-Borel offspring distribution — gborel_size_ll","text":"Sebastian Funk","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/geom_length_ll.html","id":null,"dir":"Reference","previous_headings":"","what":"Log-likelihood of the length of chains with geometric offspring distribution — geom_length_ll","title":"Log-likelihood of the length of chains with geometric offspring distribution — geom_length_ll","text":"Log-likelihood length chains geometric offspring distribution","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/geom_length_ll.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Log-likelihood of the length of chains with geometric offspring distribution — geom_length_ll","text":"","code":"geom_length_ll(x, prob)"},{"path":"https://epiforecasts.io/bpmodels/reference/geom_length_ll.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Log-likelihood of the length of chains with geometric offspring distribution — geom_length_ll","text":"x vector sizes prob probability geometric distribution mean 1/prob","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/geom_length_ll.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Log-likelihood of the length of chains with geometric offspring distribution — geom_length_ll","text":"log-likelihood values","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/geom_length_ll.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Log-likelihood of the length of chains with geometric offspring distribution — geom_length_ll","text":"Sebastian Funk","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/nbinom_size_ll.html","id":null,"dir":"Reference","previous_headings":"","what":"Log-likelihood of the size of chains with Negative-Binomial offspring distribution — nbinom_size_ll","title":"Log-likelihood of the size of chains with Negative-Binomial offspring distribution — nbinom_size_ll","text":"Log-likelihood size chains Negative-Binomial offspring distribution","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/nbinom_size_ll.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Log-likelihood of the size of chains with Negative-Binomial offspring distribution — nbinom_size_ll","text":"","code":"nbinom_size_ll(x, size, prob, mu)"},{"path":"https://epiforecasts.io/bpmodels/reference/nbinom_size_ll.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Log-likelihood of the size of chains with Negative-Binomial offspring distribution — nbinom_size_ll","text":"x vector sizes size dispersion parameter (often called k ecological applications) prob probability success (parameterisation prob, see also NegBinomial) mu mean parameter","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/nbinom_size_ll.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Log-likelihood of the size of chains with Negative-Binomial offspring distribution — nbinom_size_ll","text":"log-likelihood values","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/nbinom_size_ll.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Log-likelihood of the size of chains with Negative-Binomial offspring distribution — nbinom_size_ll","text":"Sebastian Funk","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/offspring_ll.html","id":null,"dir":"Reference","previous_headings":"","what":"Log-likelihood of the length of chains with generic offspring distribution — offspring_ll","title":"Log-likelihood of the length of chains with generic offspring distribution — offspring_ll","text":"likelihoods calculated crude approximation using simulated chains linearly approximating missing values empirical cumulative distribution function (ecdf).","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/offspring_ll.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Log-likelihood of the length of chains with generic offspring distribution — offspring_ll","text":"","code":"offspring_ll(x, offspring, stat, nsim_offspring = 100, ...)"},{"path":"https://epiforecasts.io/bpmodels/reference/offspring_ll.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Log-likelihood of the length of chains with generic offspring distribution — offspring_ll","text":"x vector sizes offspring Offspring distribution: character string corresponding R distribution function (e.g., \"pois\" Poisson, rpois R function generate Poisson random numbers) stat statistic given x (\"size\" \"length\" chains) nsim_offspring number simulations offspring distribution approximation size/length distribution ... parameters pass chain_sim","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/offspring_ll.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Log-likelihood of the length of chains with generic offspring distribution — offspring_ll","text":"log-likelihood values","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/offspring_ll.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Log-likelihood of the length of chains with generic offspring distribution — offspring_ll","text":"Sebastian Funk","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/pois_length_ll.html","id":null,"dir":"Reference","previous_headings":"","what":"Log-likelihood of the length of chains with Poisson offspring distribution — pois_length_ll","title":"Log-likelihood of the length of chains with Poisson offspring distribution — pois_length_ll","text":"Log-likelihood length chains Poisson offspring distribution","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/pois_length_ll.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Log-likelihood of the length of chains with Poisson offspring distribution — pois_length_ll","text":"","code":"pois_length_ll(x, lambda)"},{"path":"https://epiforecasts.io/bpmodels/reference/pois_length_ll.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Log-likelihood of the length of chains with Poisson offspring distribution — pois_length_ll","text":"x vector sizes lambda rate Poisson distribution","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/pois_length_ll.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Log-likelihood of the length of chains with Poisson offspring distribution — pois_length_ll","text":"log-likelihood values","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/pois_length_ll.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Log-likelihood of the length of chains with Poisson offspring distribution — pois_length_ll","text":"Sebastian Funk","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/pois_size_ll.html","id":null,"dir":"Reference","previous_headings":"","what":"Log-likelihood of the size of chains with Poisson offspring distribution — pois_size_ll","title":"Log-likelihood of the size of chains with Poisson offspring distribution — pois_size_ll","text":"Log-likelihood size chains Poisson offspring distribution","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/pois_size_ll.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Log-likelihood of the size of chains with Poisson offspring distribution — pois_size_ll","text":"","code":"pois_size_ll(x, lambda)"},{"path":"https://epiforecasts.io/bpmodels/reference/pois_size_ll.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Log-likelihood of the size of chains with Poisson offspring distribution — pois_size_ll","text":"x vector sizes lambda rate Poisson distribution","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/pois_size_ll.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Log-likelihood of the size of chains with Poisson offspring distribution — pois_size_ll","text":"log-likelihood values","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/pois_size_ll.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Log-likelihood of the size of chains with Poisson offspring distribution — pois_size_ll","text":"Sebastian Funk","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/rbinom_size.html","id":null,"dir":"Reference","previous_headings":"","what":"Samples size (the number of trials) of a binomial distribution — rbinom_size","title":"Samples size (the number of trials) of a binomial distribution — rbinom_size","text":"Samples size parameter binomial distribution fixed x (number successes) p (success probability)","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/rbinom_size.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Samples size (the number of trials) of a binomial distribution — rbinom_size","text":"","code":"rbinom_size(n, x, prob)"},{"path":"https://epiforecasts.io/bpmodels/reference/rbinom_size.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Samples size (the number of trials) of a binomial distribution — rbinom_size","text":"n number samples generate x number successes prob probability success","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/rbinom_size.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Samples size (the number of trials) of a binomial distribution — rbinom_size","text":"sampled sizes","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/rbinom_size.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Samples size (the number of trials) of a binomial distribution — rbinom_size","text":"Sebastian Funk","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/rborel.html","id":null,"dir":"Reference","previous_headings":"","what":"Random number generator from the Borel distribution — rborel","title":"Random number generator from the Borel distribution — rborel","text":"Random numbers generated simulating Poisson branching process","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/rborel.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Random number generator from the Borel distribution — rborel","text":"","code":"rborel(n, mu, infinite = Inf)"},{"path":"https://epiforecasts.io/bpmodels/reference/rborel.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Random number generator from the Borel distribution — rborel","text":"n number random variates generate. mu mu parameter (Poisson mean). infinite number treat infinite; simulations stopped number reached","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/rborel.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Random number generator from the Borel distribution — rborel","text":"vector random numbers","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/rborel.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Random number generator from the Borel distribution — rborel","text":"Sebastian Funk","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/rgen_length.html","id":null,"dir":"Reference","previous_headings":"","what":"Samples chain lengths with given observation probabilities — rgen_length","title":"Samples chain lengths with given observation probabilities — rgen_length","text":"Samples length transmission chain individual element observed binomial probability parameters n (number successes) p (success probability)","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/rgen_length.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Samples chain lengths with given observation probabilities — rgen_length","text":"","code":"rgen_length(n, x, prob)"},{"path":"https://epiforecasts.io/bpmodels/reference/rgen_length.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Samples chain lengths with given observation probabilities — rgen_length","text":"n number samples generate x observed chain lengths prob probability observation","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/rgen_length.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Samples chain lengths with given observation probabilities — rgen_length","text":"sampled lengths","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/rgen_length.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Samples chain lengths with given observation probabilities — rgen_length","text":"Sebastian Funk","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/rnbinom_mean_disp.html","id":null,"dir":"Reference","previous_headings":"","what":"Negative binomial random numbers parametrized in terms of mean and dispersion coefficient — rnbinom_mean_disp","title":"Negative binomial random numbers parametrized in terms of mean and dispersion coefficient — rnbinom_mean_disp","text":"Negative binomial random numbers parametrized terms mean dispersion coefficient","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/rnbinom_mean_disp.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Negative binomial random numbers parametrized in terms of mean and dispersion coefficient — rnbinom_mean_disp","text":"","code":"rnbinom_mean_disp(n, mn, disp)"},{"path":"https://epiforecasts.io/bpmodels/reference/rnbinom_mean_disp.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Negative binomial random numbers parametrized in terms of mean and dispersion coefficient — rnbinom_mean_disp","text":"n number samples draw mn mean distribution; Must > 0. disp dispersion coefficient (var/mean); Must > 1.","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/rnbinom_mean_disp.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Negative binomial random numbers parametrized in terms of mean and dispersion coefficient — rnbinom_mean_disp","text":"vector containing random numbers","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/rnbinom_mean_disp.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Negative binomial random numbers parametrized in terms of mean and dispersion coefficient — rnbinom_mean_disp","text":"Flavio Finger","code":""},{"path":"https://epiforecasts.io/bpmodels/reference/rnbinom_mean_disp.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Negative binomial random numbers parametrized in terms of mean and dispersion coefficient — rnbinom_mean_disp","text":"","code":"rnbinom_mean_disp(n = 5, mn = 4, disp = 2) #> [1] 8 7 6 9 6"},{"path":[]},{"path":"https://epiforecasts.io/bpmodels/news/index.html","id":"unit-tests-and-input-validation-0-3-1","dir":"Changelog","previous_headings":"","what":"Unit tests and input validation","title":"bpmodels 0.3.1","text":"following internal functions now input validation: rborel(), dborel(), complementary_logprob(), rnbinom_mean_disp(). Code coverage improved tests following functions: rborel(), dborel(), chain_sim(), rnbinom_mean_disp(), complementary_logprob(), rgen_length(), rbinom_size().","code":""},{"path":[]},{"path":"https://epiforecasts.io/bpmodels/news/index.html","id":"website-0-3-0","dir":"Changelog","previous_headings":"","what":"Website","title":"bpmodels 0.3.0","text":"website updated use bootstrap 5. means slightly new look. Exported functions “references” grouped topics.","code":""},{"path":"https://epiforecasts.io/bpmodels/news/index.html","id":"vignettes-0-3-0","dir":"Changelog","previous_headings":"","what":"Vignettes","title":"bpmodels 0.3.0","text":"new vignette added compile bibliography papers apply branching processes infectious disease epidemiology. “quickstart” section README moved “Getting started” section website. README now provides quick description core functions package users referred website quick start.","code":""},{"path":"https://epiforecasts.io/bpmodels/news/index.html","id":"readme-0-3-0","dir":"Changelog","previous_headings":"","what":"README","title":"bpmodels 0.3.0","text":"README longer quickstart section moved website. give README minimalistic look.","code":""},{"path":[]},{"path":"https://epiforecasts.io/bpmodels/news/index.html","id":"minor-functionality-change-0-2-1","dir":"Changelog","previous_headings":"","what":"Minor functionality change","title":"bpmodels 0.2.1","text":"chain_sim() now throws warning, instead error, tree set FALSE serial also specified. assume providing serial interval means want tree transmissions simulated, chain_sim() internally sets tree = TRUE throws warning explaining happened. behaviour break simulations previous versions bpmodels, , please submit issue. remove warning, user explicitly set tree = TRUE specify serial.","code":""},{"path":[]},{"path":"https://epiforecasts.io/bpmodels/news/index.html","id":"documentation-0-2-0","dir":"Changelog","previous_headings":"","what":"Documentation","title":"bpmodels 0.2.0","text":"chain_sim()’s help file updated details. particular, describe detail specify serial argument function. also added examples. new vignette describing project COVID-19 incidence chain_sim() added can accessed bpmodels website “Articles”. README’s “quick start” section updated previously introduction vignette.","code":""},{"path":"https://epiforecasts.io/bpmodels/news/index.html","id":"bpmodels-019999","dir":"Changelog","previous_headings":"","what":"bpmodels 0.1.9999","title":"bpmodels 0.1.9999","text":"faster, vectorised chain simulations","code":""},{"path":"https://epiforecasts.io/bpmodels/news/index.html","id":"bpmodels-010","dir":"Changelog","previous_headings":"","what":"bpmodels 0.1.0","title":"bpmodels 0.1.0","text":"initial release","code":""}]
diff --git a/sitemap.xml b/sitemap.xml
index 7541a88..d4a5d1e 100644
--- a/sitemap.xml
+++ b/sitemap.xml
@@ -1,93 +1,93 @@
- https://epiverse-trace.github.io/bpmodels/404.html
+ https://epiforecasts.io/bpmodels/404.html
- https://epiverse-trace.github.io/bpmodels/CONTRIBUTING.html
+ https://epiforecasts.io/bpmodels/CONTRIBUTING.html
- https://epiverse-trace.github.io/bpmodels/LICENSE-text.html
+ https://epiforecasts.io/bpmodels/LICENSE-text.html
- https://epiverse-trace.github.io/bpmodels/LICENSE.html
+ https://epiforecasts.io/bpmodels/LICENSE.html
- https://epiverse-trace.github.io/bpmodels/articles/bpmodels.html
+ https://epiforecasts.io/bpmodels/articles/bpmodels.html
- https://epiverse-trace.github.io/bpmodels/articles/branching_process_literature.html
+ https://epiforecasts.io/bpmodels/articles/branching_process_literature.html
- https://epiverse-trace.github.io/bpmodels/articles/index.html
+ https://epiforecasts.io/bpmodels/articles/index.html
- https://epiverse-trace.github.io/bpmodels/articles/projecting_incidence.html
+ https://epiforecasts.io/bpmodels/articles/projecting_incidence.html
- https://epiverse-trace.github.io/bpmodels/articles/theoretical_background.html
+ https://epiforecasts.io/bpmodels/articles/theoretical_background.html
- https://epiverse-trace.github.io/bpmodels/authors.html
+ https://epiforecasts.io/bpmodels/authors.html
- https://epiverse-trace.github.io/bpmodels/index.html
+ https://epiforecasts.io/bpmodels/index.html
- https://epiverse-trace.github.io/bpmodels/news/index.html
+ https://epiforecasts.io/bpmodels/news/index.html
- https://epiverse-trace.github.io/bpmodels/reference/bpmodels-package.html
+ https://epiforecasts.io/bpmodels/reference/bpmodels-package.html
- https://epiverse-trace.github.io/bpmodels/reference/chain_ll.html
+ https://epiforecasts.io/bpmodels/reference/chain_ll.html
- https://epiverse-trace.github.io/bpmodels/reference/chain_sim.html
+ https://epiforecasts.io/bpmodels/reference/chain_sim.html
- https://epiverse-trace.github.io/bpmodels/reference/chain_sim_susc.html
+ https://epiforecasts.io/bpmodels/reference/chain_sim_susc.html
- https://epiverse-trace.github.io/bpmodels/reference/complementary_logprob.html
+ https://epiforecasts.io/bpmodels/reference/complementary_logprob.html
- https://epiverse-trace.github.io/bpmodels/reference/covid19_sa.html
+ https://epiforecasts.io/bpmodels/reference/covid19_sa.html
- https://epiverse-trace.github.io/bpmodels/reference/dborel.html
+ https://epiforecasts.io/bpmodels/reference/dborel.html
- https://epiverse-trace.github.io/bpmodels/reference/gborel_size_ll.html
+ https://epiforecasts.io/bpmodels/reference/gborel_size_ll.html
- https://epiverse-trace.github.io/bpmodels/reference/geom_length_ll.html
+ https://epiforecasts.io/bpmodels/reference/geom_length_ll.html
- https://epiverse-trace.github.io/bpmodels/reference/index.html
+ https://epiforecasts.io/bpmodels/reference/index.html
- https://epiverse-trace.github.io/bpmodels/reference/nbinom_size_ll.html
+ https://epiforecasts.io/bpmodels/reference/nbinom_size_ll.html
- https://epiverse-trace.github.io/bpmodels/reference/offspring_ll.html
+ https://epiforecasts.io/bpmodels/reference/offspring_ll.html
- https://epiverse-trace.github.io/bpmodels/reference/pois_length_ll.html
+ https://epiforecasts.io/bpmodels/reference/pois_length_ll.html
- https://epiverse-trace.github.io/bpmodels/reference/pois_size_ll.html
+ https://epiforecasts.io/bpmodels/reference/pois_size_ll.html
- https://epiverse-trace.github.io/bpmodels/reference/rbinom_size.html
+ https://epiforecasts.io/bpmodels/reference/rbinom_size.html
- https://epiverse-trace.github.io/bpmodels/reference/rborel.html
+ https://epiforecasts.io/bpmodels/reference/rborel.html
- https://epiverse-trace.github.io/bpmodels/reference/rgen_length.html
+ https://epiforecasts.io/bpmodels/reference/rgen_length.html
- https://epiverse-trace.github.io/bpmodels/reference/rnbinom_mean_disp.html
+ https://epiforecasts.io/bpmodels/reference/rnbinom_mean_disp.html