Draws parameters from their priors and simulates the latent process, infections and observations.

# S3 method for class 'julia_spec'
simulate(object, nsim = 1, seed = NULL, n, ...)

Arguments

object

A composed model from IDModel(), or a julia() expression that builds one.

nsim

Integer. Number of simulations.

seed

Optional integer seed for the Julia random number generator.

n

Integer. Number of time points.

...

Unused.

Value

A named list of nsim x n matrices: generated_y_t (simulated observations), expected_y_t, I_t, Z_t and, for renewal models built with Renewal(), Rt. A model written as julia() code gets no Rt, since its latent scale is not known to R. Time points without an observation (e.g. before a reporting delay has elapsed) are NaN.

Examples

if (FALSE) { # \dontrun{
model <- IDModel(
  DirectInfections(Z = RandomWalk(), initialisation = Normal(log(100), 1)),
  PoissonError()
)
sims <- simulate(model, nsim = 10, n = 30, seed = 42)
matplot(t(sims$generated_y_t), type = "l")
} # }