simulate.egf_model {epigrowthfit} | R Documentation |
Simulating Incidence Time Series
Description
Simulates equally spaced incidence time series according to a specified
nonlinear model. Top level nonlinear model parameters vary between
time series according to a fixed intercept model ~ts
or random
intercept model ~(1 | ts)
.
Usage
## S3 method for class 'egf_model'
simulate(object, nsim = 1, seed = NULL,
mu, Sigma = NULL, tol = 1e-06, cstart = 0, tend = 100, ...)
Arguments
object |
an |
nsim |
a positive integer indicating a number of time series. |
seed |
an integer used to set the RNG state before simulation or,
otherwise, |
mu |
a numeric vector listing means across time series of top level
nonlinear model parameters (link scale). It is assumed that
elements are ordered as |
Sigma |
a real, symmetric positive definite matrix to be used as the
covariance matrix corresponding to |
tol |
a non-negative number indicating a tolerance for indefinite
|
cstart |
a number indicating a threshold value of cumulative incidence. Left endpoints of suggested fitting windows are those times when cumulative incidence first exceeds this threshold. |
tend |
a positive number. Simulated time series run from time 0 to time
|
... |
unused optional arguments. |
Value
A list inheriting from class simulate.egf_model
, with elements:
model |
copy of argument |
formula_ts |
a formula, always |
formula_windows |
a formula, always |
formula_parameters |
a formula specifying the generative model.
If |
data_ts |
a data frame with variables |
data_windows |
a data frame with |
init |
a named list of the form |
Y |
a numeric matrix with |
call |
the call to |
Attribute RNGstate
preserves the RNG state prior to simulation,
making the result reproducible.
See Also
The generic function simulate
.
Examples
r <- 0.04
c0 <- 400
s <- 0.2
mu <- log(c(r, c0))
Sigma <- diag(rep.int(s^2, length(mu)))
zz <- simulate(object = egf_model(curve = "exponential", family = "pois"),
nsim = 20L,
seed = 202737L,
mu = mu,
Sigma = Sigma,
cstart = 10)
str(zz)
mm <- egf(zz)
(pp <- cbind(actual = coef(zz), fitted = coef(mm)))