Learn R Programming

synlik (version 0.1.6)

simulate,synlik-method: Simulate data or statistics from an object of class synlik.

Description

Simulate data or statistics from an object of class synlik.

Usage

# S4 method for synlik
simulate(object, nsim, seed = NULL, param = object@param,
  stats = FALSE, clean = TRUE, verbose = TRUE, ...)

Value

If stats == FALSE the output will that of object@simulator, which depends on the simulator used by the user. If stats == TRUE the output will be a matrix where each row is vector of simulated summary statistics.

Arguments

object

An object of class synlik.

nsim

Number of simulations from the model.

seed

Random seed to be used. It is not passed to the simulator, but simply passed to set.seed() from within simulate.synlik.

param

Vector of parameters passed to object@simulator.

stats

If TRUE the function trasforms the simulated data into statistics using object@summaries.

clean

If TRUE the function tries to clean the statistics from NaNs or non-finite values. Given that object@summaries has to returns a numeric vector or a matrix where each row is a simulation, rows containing non-finite values will be discarded.

verbose

If TRUE the function will complain if, for instance, the simulations contain lots of non-finite values.

...

additional arguments to be passed to object@simulator and object@summaries. In general I would avoid using it and including object@extraArgs everything they need.

Author

Matteo Fasiolo <matteo.fasiolo@gmail.com>

See Also

synlik-class, simulate.

Examples

Run this code
data(ricker_sl)

# Simulate data
simulate(ricker_sl, nsim = 2)

# Simulate statistics
simulate(ricker_sl, nsim = 2, stats = TRUE)                                              

Run the code above in your browser using DataLab