samplers

0th

Percentile

MCMC samplers

Functions to set up MCMC samplers and change the starting values of their parameters, for use in mcmc().

Usage
hmc(Lmin = 5, Lmax = 10, epsilon = 0.1, diag_sd = 1)

rwmh(proposal = c("normal", "uniform"), epsilon = 0.1, diag_sd = 1)

slice(max_doublings = 5)

Arguments
Lmin

minimum number of leapfrog steps (positive integer, Lmin > Lmax)

Lmax

maximum number of leapfrog steps (positive integer, Lmax > Lmin)

epsilon

leapfrog stepsize hyperparameter (positive, will be tuned)

diag_sd

estimate of the posterior marginal standard deviations (positive, will be tuned).

proposal

the probability distribution used to generate proposal states

max_doublings

the maximum number of iterations of the 'doubling' algorithm used to adapt the size of the slice

Details

During the warmup iterations of mcmc, some of these sampler parameters will be tuned to improve the efficiency of the sampler, so the values provided here are used as starting values.

For hmc(), the number of leapfrog steps at each iteration is selected uniformly at random from between Lmin and Lmax. diag_sd is used to rescale the parameter space to make it more uniform, and make sampling more efficient.

rwmh() creates a random walk Metropolis-Hastings sampler; a a gradient-free sampling algorithm. The algorithm involves a proposal generating step `proposal_state = current_state + perturb` by a random perturbation, followed by Metropolis-Hastings accept/reject step. The class is implemented for uniform and normal proposals.

slice() implements a multivariate slice sampling algorithm. Currently this algorithm can only be used with single-precision models (set using the precision argument to model). The parameter max_doublings is not tuned during warmup.

Value

a sampler object that can be passed to mcmc.

Aliases
  • samplers
  • hmc
  • rwmh
  • slice
Documentation reproduced from package greta, version 0.3.0, License: Apache License 2.0

Community examples

Looks like there are no examples yet.