synlik-class | R Documentation |
synlik-class
Basic class for simulation-based approximate inference using Synthetic Likelihood methods.
synlik(...)
... |
See section "Slots". |
Named vector of parameters used by object@simulator
(numeric
).
Function that simulates from the model (function
). It has to have prototype fun(param, nsim, extraArgs, ...)
.
If summaries()
is not specified the simulator()
has output a matrix with nsim
rows, where
each row is a vector of simulated statistics. Otherwise it can output any kind of object, and this output will be
passed to summaries()
.
Function that transforms simulated data into summary statistics (function
).
It has to have prototype fun(x, extraArgs, ...)
and it has to output a matrix with nsim
rows, where
each row is a vector of simulated statistics. Parameter x
contains the data.
Object containing the observed data or statistics (ANY
).
List containing all the extra arguments to be passed to object@simulator
and object@summaries
(list
).
Function that will be used to plot object@data
. Prototype should be fun(x, ...)
(function
).
Matteo Fasiolo <matteo.fasiolo@gmail.com>
Simon N Wood. Statistical inference for noisy nonlinear ecological dynamic systems. Nature, 466(7310):1102–1104, 2010.
#### Create Object
ricker_sl <- synlik(simulator = rickerSimul,
summaries = rickerStats,
param = c( logR = 3.8, logSigma = log(0.3), logPhi = log(10) ),
extraArgs = list("nObs" = 50, "nBurn" = 50),
plotFun = function(input, ...)
plot(drop(input), type = 'l', ylab = "Pop", xlab = "Time", ...)
)
# Simulate from the object
ricker_sl@data <- simulate(ricker_sl)
ricker_sl@extraArgs$obsData <- ricker_sl@data # Needed by WOOD2010 statistics
plot(ricker_sl)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.