Simulate transmission chains using a stochastic branching process
Source:R/utils.R
dot-chain_sim.RdCode modified from the bpmodels::chain_sim() function.
The function chain_sim() function from bpmodels is reused with
permission and licensed under MIT as is bpmodels.
bpmodels is not on CRAN and is retired.
Usage
.chain_sim(
n,
offspring,
stat = c("size", "length"),
stat_threshold = Inf,
generation_time,
tf = Inf,
...
)Arguments
- n
Number of simulations to run.
- offspring
Offspring distribution: a character string corresponding to the R distribution function (e.g., "pois" for Poisson, where
rpois()is the R function to generate Poisson random numbers).- stat
String; Statistic to calculate. Can be one of:
"size": the total number of offspring.
"length": the total number of ancestors.
- stat_threshold
A size or length above which the simulation results should be set to
Inf. Defaults toInf, resulting in no results ever set toInf.- generation_time
The generation time generator function; the name of a user-defined named or anonymous function with only one argument
n, representing the number of generation times to generate.- tf
End time (if
generation_timeinterval is given).- ...
Parameters of the offspring distribution as required by R.