Metropolis_OAAT_adaptive | R Documentation |
Performs nsim iterations of the Adaptive version of the OAAT Metropolis sampler (see ?Metropolis_OAAT). Adaptation is performed by monitoring move rates every batch.length iterations, and increasing / decreasing the jump standard deviation if the move rate is not within specified bounds.
Metropolis_OAAT_adaptive(
f,
x0,
sdjump,
...,
batch.length = 100,
batch.n = 100,
moverate.min = 0.1,
moverate.max = 0.5,
mult.down = 0.9,
mult.up = 1.1
)
f |
function, log-pdf of the target distribution |
x0 |
numeric vector, starting point |
sdjump |
numeric vector, initial standard deviation of the Gaussian jump for each component |
... |
other arguments passed to f |
batch.length |
integer, length of each non-adaptive batch |
batch.n |
integer, number of batches (= adaptation period). Total number of simulations is nsim=batch.n*batch.length |
moverate.min |
numeric in (0;1), lower bound for the desired move rate interval |
moverate.max |
numeric in (0;1), upper bound for the desired move rate interval |
mult.down |
numeric in (0;1), multiplication factor used to decrease jump size when move rate is too low. |
mult.up |
numeric (>1, avoid 1/mult.down) multiplication factor used to increase jump size when move rate is too high. |
A list with the following components:
x |
numeric matrix nsim*length(x0), MCMC simulations |
fx |
numeric vector, corresponding values f(x) |
# Bivariate target distribution: beta(0.8,0.4) X exp(1)
f=function(x){stats::dbeta(x[1],0.8,0.4,log=TRUE)+stats::dexp(x[2],log=TRUE)}
x0=c(0.5,2)
sdjump=c(0.5,1)
mcmc=Metropolis_OAAT_adaptive(f,x0,sdjump)
graphicalpar=par(mfrow=c(1,3))
plot(mcmc$x);hist(mcmc$x[,1]); hist(mcmc$x[,2])
par(graphicalpar)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.