synlik-class {synlik}R Documentation

synlik-class

Description

Basic class for simulation-based approximate inference using Synthetic Likelihood methods.

Usage

synlik(...)

Arguments

...

See section "Slots".

Slots

param

Named vector of parameters used by object@simulator (numeric).

simulator

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

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.

data

Object containing the observed data or statistics (ANY).

extraArgs

List containing all the extra arguments to be passed to object@simulator and object@summaries (list).

plotFun

Function that will be used to plot object@data. Prototype should be fun(x, ...) (function).

Author(s)

Matteo Fasiolo <matteo.fasiolo@gmail.com>

References

Simon N Wood. Statistical inference for noisy nonlinear ecological dynamic systems. Nature, 466(7310):1102–1104, 2010.

Examples

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

[Package synlik version 0.1.6 Index]