Last chance! 50% off unlimited learning
Sale ends in
synlik
.Simulate data or statistics from an object of class synlik
.
# S4 method for synlik
simulate(object, nsim, seed = NULL, param = object@param,
stats = FALSE, clean = TRUE, verbose = TRUE, ...)
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.
An object of class synlik
.
Number of simulations from the model.
Random seed to be used. It is not passed to the simulator, but simply passed to set.seed()
from within
simulate.synlik
.
Vector of parameters passed to object@simulator
.
If TRUE
the function trasforms the simulated data into statistics using object@summaries
.
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.
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.
Matteo Fasiolo <matteo.fasiolo@gmail.com>
synlik-class
, simulate
.
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