Learn R Programming

MARSS (version 3.2)

MARSSsimulate: Simulate Data from a MARSS Model and Parameter Estimates

Description

Generates simulated data from a MARSS model with specified parameter estimates. This is a base function in the MARSS-package.

Usage

MARSSsimulate(MLEobj, tSteps = 100, nsim = 1, silent = TRUE, 
  miss.loc = NULL)

Arguments

MLEobj
A marss MLE model object marssMLE.
tSteps
Number of time steps in each simulation.
nsim
Number of simulated data sets to generate.
silent
Suppresses progress bar.
miss.loc
Optional matrix specifying where to put missing values. See Details.

Value

  • sim.statesArray (dim m x tSteps x nsim) of state processes simulated from parameter estimates.
  • sim.dataArray (dim n x tSteps x nsim) of data simulated from parameter estimates.
  • parThe list of parameter matrices from which the data were simulated.
  • miss.locMatrix identifying where missing values are located.
  • tStepsNumber of time steps in each simulation.
  • nsimNumber of simulated data sets generated.

Details

Argument miss.loc is an array of dimensions n x tSteps x nsim, specifying where to put missing values in the simulated data. If missing, this would be constructed using modelObj$data and modelObj$miss.value. If the locations of the missing values are the same for all simulations, miss.loc can be a matrix of dim=c(n, tSteps) (the original data for example). If miss.loc is passed in, missing values must be specified as modelObj$miss.value. The default, if miss.loc is left off, is that there are no missing values even if modelObj$data has missing values.

See Also

marssm marssMLE MARSSboot

Examples

Run this code
#do a parametric bootstrap.  
  #Same length as original data and same location of missing data
  d = harborSeal[,c(2,11)]
  dat = t(d)
  MLEobj = MARSS(dat)
  sim.obj = MARSSsimulate(MLEobj, tSteps=dim(d)[1], nsim=10)

Run the code above in your browser using DataLab