Skip to contents

Generates truth-twin realisations by Euler-Maruyama integration, optionally retaining the hidden path and the driving Wiener increments so that a later ensemble smoother can reuse them.

Usage

# S3 method for class 'stochastic_model'
simulate(
  object,
  nsim = 1,
  seed = NULL,
  t_end,
  dt,
  ic = NULL,
  burn_in = 0,
  keep_hidden = TRUE,
  keep_noise = TRUE,
  ...
)

Arguments

object

A stochastic_model or cgns_model object.

nsim

Positive whole number of realisations to generate.

seed

Optional non-negative whole number seeding the generator. Seeding is contained: an existing .Random.seed is restored bit for bit when the call returns, so a reproducible path leaves the caller's stream where it was and the next draw is the draw that would have followed no call at all. When no .Random.seed exists, one is created before the seeded draw so that there is a state to restore, and the caller is left holding it. An unseeded call draws from, and advances, the caller's stream as usual.

t_end

Positive 1-length numeric total simulated time, excluding burn-in. Called T before 0.1.0; that deprecated name remains accepted with a warning. Use t_end in new code.

dt

Positive 1-length numeric integration step.

ic

Optional list with elements x0 and y0 giving the initial state; NULL uses the model's default initial condition.

burn_in

Non-negative 1-length numeric time discarded before recording.

keep_hidden

TRUE to retain the hidden path.

keep_noise

TRUE to retain the driving Wiener increments.

...

Must be empty; unused arguments are an error.

Value

An object of class aci_sim when nsim is one, otherwise a list of such objects. Its observed trajectory carries the model's own channel names when meta$vars$observed supplies one unique non-empty name per observed channel, as the built-in constructors do, so that aci_conditional()'s given and target can be named straight off a simulation. The names are labels: no numeric result depends on them.