Implementation of Vihola (2012)'s Robust Adaptive Metropolis.

kernel_ram(
  mu = 0,
  eta = function(i, k) min(c(1, i^(-2/3) * k)),
  qfun = function(k) stats::rt(k, k),
  arate = 0.234,
  freq = 1L,
  warmup = 0L,
  Sigma = NULL,
  eps = 1e-04,
  lb = -.Machine$double.xmax,
  ub = .Machine$double.xmax,
  fixed = FALSE,
  until = Inf,
  constr = NULL
)

Arguments

mu

Either a numeric vector or a scalar. Proposal mean. If scalar, values are recycled to match the number of parameters in the objective function.

eta

A function that receives the MCMC environment. This is to calculate the scaling factor for the adaptation.

qfun

Function. As described in Vihola (2012)'s, the qfun function is a symmetric function used to generate random numbers.

arate

Numeric scalar. Objective acceptance rate.

freq

Integer scalar. Frequency of updates. How often the variance-covariance matrix is updated.

warmup

Integer scalar. The number of iterations that the algorithm has to wait before starting to do the updates.

Sigma

The variance-covariance matrix. By default this will be an identity matrix during the warmup period.

eps

Double scalar. Default size of the initial step (see details).

lb, ub

Either a numeric vector or a scalar. Lower and upper bounds for bounded kernels. When of length 1, the values are recycled to match the number of parameters in the objective function.

fixed

Logical scalar or vector of length k. Indicates which parameters will be treated as fixed or not. Single values are recycled.

until

Integer scalar. Last step at which adaptation takes place (see details).

constr

Logical lower-diagonal square matrix of size k. Not in the original paper, but rather a tweak that imposes a constraint on the S_n matrix. If different from NULL, the kernel multiplates S_n by this constraint so that zero elements are pre-imposed.

Value

An object of class fmcmc_kernel.

Details

While it has been shown that under regular conditions this transition kernel generates ergodic chains even when the adaptation does not stop, some practitioners may want to stop adaptation at some point.

The idea is similar to that of the Adaptive Metropolis algorithm (AM implemented as kernel_adapt() here) with the difference that it takes into account a target acceptance rate.

The eta function regulates the rate of adaptation. The default implementation will decrease the rate of adaptation exponentially as a function of the iteration number.

$$%latex Y_n\equiv X_{n-1} + S_{n-1}U_n,\quad\mbox{where }U_n\sim q\mbox{ (the \texttt{qfun})}% $$

And the \(S_n\) matrix is updated according to the following equation:

$$% latex S_nS_n^T = S_{n-1}\left(I + \eta_n(\alpha_n - \alpha_*)\frac{U_nU_n^T}{\|U_n\|^2}\right)S_{n-1}^T% $$

References

Vihola, M. (2012). Robust adaptive Metropolis algorithm with coerced acceptance rate. Statistics and Computing, 22(5), 997–1008. doi:10.1007/s11222-011-9269-5

See also

Examples

# Setting the acceptance rate to 30 % and deferring the updates until
# after 1000 steps
kern <- kernel_ram(arate = .3, warmup = 1000)