simulate.egf | R Documentation |
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.
## S3 method for class 'egf'
simulate(object, nsim = 1, seed = NULL,
bootstrap = FALSE,
control = list(), parallel = egf_parallel(),
trace = FALSE, ...)
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. |
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
.
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.
The generic function simulate
.
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.