Description Slots Author(s) References Examples

Object representing the results of MCMC estimation on an
object of class `synlik`

, from which it inherits.

- initPar
Vector of initial parameters where the MCMC chain will start (

`numeric`

).- niter
Number of MCMC iterations (

`integer`

).- nsim
Number of simulations from the simulator at each step of the MCMC algorithm (

`integer`

).- burn
Number of initial MCMC iterations that are discarded (

`integer`

).- priorFun
Function that takes a vector of parameters as input and the log-density of the prior as output. If the output is not finite the proposed point will be discarded. (

`function`

). The function needs to have signature`fun(x, ...)`

, where`x`

represents the input parameters (`function`

).- propCov
Matrix representing the covariance matrix to be used to perturb the parameters at each step of the MCMC chain (

`matrix`

).- targetRate
Target rate for the adaptive MCMC sampler. Should be in (0, 1), default is NULL (no adaptation). The adaptation uses the approach of Vihola (2011). (

`numeric`

)- recompute
If TRUE the synthetic likelihood will be evaluated at the current and proposed positions in the parameter space (thus doubling the computational effort). If FALSE the likelihood of the current position won't be re-estimated (

`logical`

).- multicore
If TRUE the

`[email protected]`

and`[email protected]`

functions will be executed in parallel. That is the nsim simulations will be divided in multiple cores (`logical`

).- ncores
Number of cores to use if multicore == TRUE (

`integer`

).- accRate
Acceptance rate of the MCMC chain, between 0 and 1 (

`numeric`

).- chains
Matrix of size niter by length(initPar) where the i-th row contains the position of the MCMC algorithm in the parameter space at the i-th (

`matrix`

).- llkChain
Vector of niter elements where the i-th element is contains the estimate of the synthetic likelihood at the i-th iteration (

`numeric`

).- control
Control parameters used by the MCMC sampler:

`theta`

= controls the speed of adaption. Should be between 0.5 and 1. A lower gamma leads to faster adaption.`adaptStart`

= iteration where the adaption starts. Default 0.`adaptStop`

= iteration where the adaption stops. Default`burn + niter`

`saveFile`

= path to the file where the intermediate results will be stored (ex: "~/Res.RData").`saveFreq`

= frequency with which the intermediate results will be saved on`saveFile`

. Default 100.`verbose`

= if`TRUE`

intermediate posterior means will be printer.`verbFreq`

= frequency with which the intermediate posterior means will be printer. Default 500.

Matteo Fasiolo <[email protected]>

Vihola, M. (2011) Robust adaptive Metropolis algorithm with coerced acceptance rate. Statistics and Computing.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ```
# Load "synlik" object
data(ricker_sl)
plot(ricker_sl)
# MCMC estimation
set.seed(4235)
ricker_sl <- smcmc(ricker_sl,
initPar = c(3.2, -1, 2.6),
niter = 50,
burn = 3,
priorFun = function(input, ...) 1,
propCov = diag( c(0.1, 0.1, 0.1) )^2,
nsim = 200,
multicore = FALSE)
# Continue with additional 50 iterations
ricker_sl <- continue(ricker_sl, niter = 50)
plot(ricker_sl)
``` |

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

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.