synlik-class: 'synlik-class'

Description Usage Arguments Slots Author(s) References Examples

Description

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

Usage

1

Arguments

...

See section "Slots".

Slots

param

Named vector of parameters used by [email protected] (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 [email protected] and [email protected] (list).

plotFun

Function that will be used to plot [email protected]. Prototype should be fun(x, ...) (function).

Author(s)

Matteo Fasiolo <[email protected]>

References

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
#### 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)

synlik documentation built on May 29, 2017, 12:16 p.m.