simulate.egf {epigrowthfit} | R Documentation |
Simulation and Parametric Bootstrapping
Description
Simulates incidence data conditional on a fitted nonlinear mixed effects model of epidemic growth. Optionally re-estimates the model given the simulated data, thus generating samples from the conditional distribution of the bottom level parameter vector.
Usage
## S3 method for class 'egf'
simulate(object, nsim = 1, seed = NULL,
bootstrap = FALSE,
control = list(), parallel = egf_parallel(),
trace = FALSE, ...)
Arguments
object |
an |
nsim |
a positive integer indicating a number of replications. |
seed |
an integer used to set the RNG state before simulation or,
otherwise, |
bootstrap |
a logical. If |
control |
passed to |
parallel |
an |
trace |
a logical. If |
... |
additional arguments passed from or to other methods. |
Details
Bootstrap optimizations are typically expensive for nontrivial models.
They are parallelized at the C++ level when there is OpenMP
support and object[["control"]][["omp_num_threads"]]
is set
to an integer greater than 1. When there is no OpenMP support, they
can still be parallelized at the R level with appropriate setting
of argument parallel
.
Arguments control
, parallel
, and trace
are unused
when bootstrap = FALSE
.
Value
A list inheriting from class simulate.egf
, with elements:
simulation |
a data frame containing simulated incidence data. It has variables
|
bootstrap |
a numeric matrix with |
Attribute RNGstate
preserves the RNG state prior to simulation,
making the result reproducible.
See Also
The generic function simulate
.
Examples
example("egf", package = "epigrowthfit")
zz <- simulate(m2, nsim = 6L, seed = 181952L, bootstrap = TRUE)
str(zz)
matplot(t(zz[["bootstrap"]][!m2[["random"]], ]),
type = "o", las = 1, xlab = "simulation", ylab = "value")