simulate: Generate simulated data from TMB models in SAMtool

simulateR Documentation

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 signature 'Assessment'
simulate(
  object,
  nsim = 1,
  seed = NULL,
  process_error = FALSE,
  refit = FALSE,
  cores = 1,
  ...
)

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

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.

Details

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

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).

Author(s)

Q. Huynh


SAMtool documentation built on Sept. 11, 2024, 8:07 p.m.