smcmc-class | R Documentation |
smcmc-class
Object representing the results of MCMC estimation on an object of class synlik
, from which it inherits.
Vector of initial parameters where the MCMC chain will start (numeric
).
Number of MCMC iterations (integer
).
Number of simulations from the simulator at each step of the MCMC algorithm (integer
).
Number of initial MCMC iterations that are discarded (integer
).
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
).
Matrix representing the covariance matrix to be used to perturb the
parameters at each step of the MCMC chain (matrix
).
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
)
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
).
If TRUE the object@simulator
and object@summaries
functions will
be executed in parallel. That is the nsim simulations will be divided in multiple cores (logical
).
Number of cores to use if multicore == TRUE (integer
).
Acceptance rate of the MCMC chain, between 0 and 1 (numeric
).
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
).
Vector of niter elements where the i-th element is contains the estimate of the
synthetic likelihood at the i-th iteration (numeric
).
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 <matteo.fasiolo@gmail.com>
Vihola, M. (2011) Robust adaptive Metropolis algorithm with coerced acceptance rate. Statistics and Computing.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.