View source: R/simulate_secondary.R
simulate_secondary | R Documentation |
Simulations are done from a given trajectory of primary observations by applying any given delays and observation parameters.
simulate_secondary(
primary,
day_of_week_effect = NULL,
secondary = secondary_opts(),
delays = delay_opts(),
truncation = trunc_opts(),
obs = obs_opts(),
CrIs = c(0.2, 0.5, 0.9),
backend = "rstan",
...
)
primary |
a data frame of primary reports (column |
day_of_week_effect |
either |
secondary |
A call to |
delays |
A call to |
truncation |
A call to |
obs |
A list of options as generated by |
CrIs |
Numeric vector of credible intervals to calculate. |
backend |
Character string indicating the backend to use for fitting stan models. Supported arguments are "rstan" (default) or "cmdstanr". |
... |
deprecated; only included for backward compatibility |
In order to simulate, all parameters that are specified such as the mean and standard deviation of delays or observation scaling, must be fixed. Uncertain parameters are not allowed.
A function of the same name that was previously based on a reimplementation of that model in R with potentially time-varying scalings and delays is available as 'convolve_and_scale()
A data.table of simulated secondary observations (column secondary
)
by date.
## load data.table to manipulate `example_confirmed` below
library(data.table)
cases <- as.data.table(example_confirmed)[, primary := confirm]
sim <- simulate_secondary(
cases,
delays = delay_opts(fix_parameters(example_reporting_delay)),
obs = obs_opts(family = "poisson")
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.