Simulations from a stochastic epidemic model.
simulate_stem(
stem_object,
nsim = 1,
simulation_parameters = NULL,
lna_draws = NULL,
tparam_draws = NULL,
tparam_values = NULL,
paths = FALSE,
full_paths = FALSE,
observations = FALSE,
method = "gillespie",
tmax = NULL,
census_times = NULL,
max_attempts = 500,
lna_method = "exact",
lna_bracket_width = 2 * pi,
ess_warmup = 100,
messages = TRUE
)
stem object list
number of realizations to simulate
optional list of vectors of simulation parameters. If NULL, paths are simulated using the parameters specified in the stem object.
optional list of matrices of lna draws
optional list of lists of time-varying parameter draws
Should population-level paths at census times be returned?
Should complete population level paths be returned (only for Gillespie), defaults to FALSE
Should simulated observations be returned? Requires that a measurement process be defined in the stem object.
either "gillespie" if simulating via Gillespie's direct method, "lna" if simulating paths via the linear noise approximation, or "ode" if simulating paths of the deterministic limit of the underlying Markov jump process.
the time at which simulation of the system is terminated. Defaults to the last observation time if not supplied.
vector of times at which compartment counts should be recorded.
maximum number of times to attempt simulating an LNA path before aborting due to the moments of the path being degenerate at some point
defaults to "exact". If "approx", an initial path is proposed by resampling perturbations that lead to negative increments or volumes. The initial path is then updated via elliptical slice sampling
initial elliptical slice sampling bracket width to be used if lna_method == "approx"
number of elliptical slice sampling updates before the lna sample is saved
should a message be printed when parsing the rates?
Returns a list with the simulated paths, subject-level paths, and/or
datasets. If paths = FALSE
and observations = FALSE
, or if
paths = TRUE
and observations = TRUE
, a list nsim stem
paths and datasets, each returned either as a list or array, is returned.
If paths = TRUE
and observations = FALSE
, a list or array of
simulated population-level paths is returned.
If paths = FALSE
and observations = TRUE
, a list or array of
simulated datasets is returned.