sim_generations | R Documentation |
This is based on Cori et al. 2019 (https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1006554), which works out analytical expectations of the number of unobserved generations between linked cases given a detection probaility.
sim_generations(
t_diff,
si_fun,
params,
max_kappa = 100,
kappa_weights = TRUE,
known_kappas = NULL,
sort = TRUE
)
t_diff |
the observed time differences between linked cases |
si_fun |
a function for the serial interval with arguments N (the number to draw) and params (a list of parameters for the function), see si_fun_lnorm for an example. |
params |
a list with parameters for the si_fun function to draw serial intervals |
max_kappa |
integer, the constrained maximum number of generatios between two linked cases |
kappa_weights |
boolean, whether to return the simulated generations for each case or the weights (i.e. the proportion of cases separated by 1:max_kappa generations) |
known_kappas |
vector of known kappas (i.e. if some cases are traced, you know kappa = 1 for these cases) |
sort |
whether to sort the first column and t_diff to weight towards kappa = 1 to deal with higher sensitivity at higher reporting thresholds |
either a vector of the simulated generations or a vector of proportions of 1:max_kappa
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.