Learn R Programming

SAMtool (version 1.7.0)

simulate: Generate simulated data from TMB models in SAMtool

Description

A convenient wrapper function (simulate) to simulate data (and process error) from the likelihood function.

Usage

simulate(object, ...)

# S4 method for Assessment simulate( object, nsim = 1, seed = NULL, process_error = FALSE, refit = FALSE, cores = 1, ... )

# S4 method for RCModel simulate( object, nsim = 1, seed = NULL, process_error = FALSE, refit = FALSE, cores = 1, ... )

Value

A sim object returning the original data, simulated data, original parameters, parameters estimated from simulated data, and process error used to simulate data. then a nested list of model output (opt, SD, and report).

Arguments

object

An object of class Assessment or RCModel containing the fitted model.

...

Additional arguments

nsim

Number of simulations

seed

Used for the random number generator

process_error

Logical, indicates if process error is re-sampled in the simulation.

refit

Logical, whether to re-fit the model for each simulated dataset.

cores

The number of CPUs for parallel processing for model re-fitting if refit = TRUE.

Author

Q. Huynh

Details

Process error, e.g., recruitment deviations, will be re-sampled in the simulation.