
Generate an outbreak case count series defined by Reproduction number using a poisson model.
Source:R/simulation-utils.R
sim_poisson_Rt_model.Rd
Generate an outbreak case count series defined by Reproduction number using a poisson model.
Arguments
- changes
a dataframe holding change time points (
t
) and reproduction number (rt
) columns- kappa
a dispersion parameter. 1 is no dispersion (compared to poisson), smaller values mean more dispersion.
- max_time
the desired length of the time series,
- seed
a random seed
- fn_Rt
a function that takes input vector
t
and returns the instantaneous reproduction number at timet
- fn_imports
a function that takes input vector
t
and returns the number of imported cases at timest
.- fn_ip
a function that takes input vector
t
and returns an infectivity profile at timest
.- time_unit
e.g. a daily or weekly time series: "1 day", "7 days"
Value
A dataframe containing the following columns:
count (positive_integer) - Positive case counts associated with the specified timeframe
time (ggoutbreak::time_period + group_unique) - A (usually complete) set of singular observations per unit time as a
time_period
Ungrouped.
Examples
tmp = sim_poisson_Rt_model(kappa=1, seed=100, fn_imports = ~ ifelse(.x %in% c(0,50),100,0))
if (interactive()) {
ggplot2::ggplot(tmp,ggplot2::aes(x=time,y=count))+ggplot2::geom_point()+
ggplot2::geom_line()
}