simulate: Simulations of a partially-observed Markov process

Description Usage Arguments Value Author(s) See Also

Description

simulate generates simulations of the state and measurement processes.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## S4 method for signature 'missing'
simulate(nsim = 1, seed = NULL, times, t0, params,
  rinit, rprocess, rmeasure, format = c("pomps", "arrays", "data.frame"),
  include.data = FALSE, ..., verbose = getOption("verbose", FALSE))

## S4 method for signature 'data.frame'
simulate(object, nsim = 1, seed = NULL, times,
  t0, params, rinit, rprocess, rmeasure, format = c("pomps", "arrays",
  "data.frame"), include.data = FALSE, ...,
  verbose = getOption("verbose", FALSE))

## S4 method for signature 'pomp'
simulate(object, nsim = 1, seed = NULL,
  format = c("pomps", "arrays", "data.frame"), include.data = FALSE,
  ..., verbose = getOption("verbose", FALSE))

## S4 method for signature 'objfun'
simulate(object, nsim = 1, seed = NULL, ...)

Arguments

nsim

The number of simulations to perform. Note that the number of replicates will be nsim times ncol(params).

seed

optional; if set, the pseudorandom number generator (RNG) will be initialized with seed. the random seed to use. The RNG will be restored to its original state afterward.

times

the times at which observations are made. times must indicate the column of observation times by name or index. The time vector must be numeric and non-decreasing. Internally, data will be internally coerced to an array with storage-mode double.

t0

The zero-time, i.e., the time of the initial state. This must be no later than the time of the first observation, i.e., t0 <= times[1].

params

a named numeric vector or a matrix with rownames containing the parameters at which the simulations are to be performed.

rinit

simulator of the initial-state distribution. This can be furnished either as a C snippet, an R function, or the name of a pre-compiled native routine available in a dynamically loaded library. Setting rinit=NULL sets the initial-state simulator to its default. For more information, see here.

rprocess

simulator of the latent state process, specified using one of the rprocess plugins. Setting rprocess=NULL removes the latent-state simulator. For more information, see the documentation on these plugins.

rmeasure

simulator of the measurement model, specified either as a C snippet, an R function, or the name of a pre-compiled native routine available in a dynamically loaded library. Setting rmeasure=NULL removes the measurement model simulator. For more information, see here.

format

the format in which to return the results.

format = "pomps" causes the results to be returned as a single “pomp” object, identical to object except for the latent states and observations, which have been replaced by the simulated values.

format = "arrays" causes the results to be returned as a list of two arrays. The “states” element will contain the simulated state trajectories in a rank-3 array with dimensions nvar x (ncol(params)*nsim) x ntimes. Here, nvar is the number of state variables and ntimes the length of the argument times. The “obs” element will contain the simulated data, returned as a rank-3 array with dimensions nobs x (ncol(params)*nsim) x ntimes. Here, nobs is the number of observables.

format = "data.frame" causes the results to be returned as a single data frame containing the time, states, and observations. An ordered factor variable, ‘.id’, distinguishes one simulation from another.

include.data

if TRUE, the original data are included (with .id = "rep"). This option is ignored unless format = "data.frame".

...

additional arguments supply new or modify existing model characteristics or components. See pomp for a full list of recognized arguments.

When named arguments not recognized by pomp are provided, these are made available to all basic components via the so-called userdata facility. This allows the user to pass information to the basic components outside of the usual routes of covariates (covar) and model parameters (params). See the userdata documentation here for information on how to use this facility.

verbose

logical; if TRUE, diagnostic messages will be printed to the console.

object

optional; if present, it should be the output of one of pomp's methods

Value

A single “pomp” object, a “pompList” object, a named list of two arrays, or a data frame, according to the format option.

If params is a matrix, each column is treated as a distinct parameter set. In this case, if nsim=1, then simulate will return one simulation for each parameter set. If nsim>1, then simulate will yield nsim simulations for each parameter set. These will be ordered such that the first ncol(params) simulations represent one simulation from each of the distinct parameter sets, the second ncol(params) simulations represent a second simulation from each, and so on.

Adding column names to params can be helpful.

Author(s)

Aaron A. King

See Also

Other elementary POMP methods: pfilter, pomp2-package, probe, spect


kidusasfaw/pomp documentation built on May 20, 2019, 2:59 p.m.