Package: rmcmc 0.1.1

Matthew M. Graham

rmcmc: Robust Markov Chain Monte Carlo Methods

Functions for simulating Markov chains using the Barker proposal to compute Markov chain Monte Carlo (MCMC) estimates of expectations with respect to a target distribution on a real-valued vector space. The Barker proposal, described in Livingstone and Zanella (2022) <doi:10.1111/rssb.12482>, is a gradient-based MCMC algorithm inspired by the Barker accept-reject rule. It combines the robustness of simpler MCMC schemes, such as random-walk Metropolis, with the efficiency of gradient-based methods, such as the Metropolis adjusted Langevin algorithm. The key function provided by the package is sample_chain(), which allows sampling a Markov chain with a specified target distribution as its stationary distribution. The chain is sampled by generating proposals and accepting or rejecting them using a Metropolis-Hasting acceptance rule. During an initial warm-up stage, the parameters of the proposal distribution can be adapted, with adapters available to both: tune the scale of the proposals by coercing the average acceptance rate to a target value; tune the shape of the proposals to match covariance estimates under the target distribution. As well as the default Barker proposal, the package also provides implementations of alternative proposal distributions, such as (Gaussian) random walk and Langevin proposals. Optionally, if 'BridgeStan's R interface <https://roualdes.github.io/bridgestan/latest/languages/r.html>, available on GitHub <https://github.com/roualdes/bridgestan>, is installed, then 'BridgeStan' can be used to specify the target distribution to sample from.

Authors:Matthew M. Graham [aut, cre], Samuel Livingstone [aut], University College London [cph], Engineering and Physical Sciences Research Council [fnd]

rmcmc_0.1.1.tar.gz
rmcmc_0.1.1.tar.gz(r-4.5-noble)rmcmc_0.1.1.tar.gz(r-4.4-noble)
rmcmc_0.1.1.tgz(r-4.4-emscripten)rmcmc_0.1.1.tgz(r-4.3-emscripten)
rmcmc.pdf |rmcmc.html
rmcmc/json (API)
NEWS

# Install 'rmcmc' in R:
install.packages('rmcmc', repos = c('https://cran.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/ucl/rmcmc/issues

Pkgdown site:https://github-pages.ucl.ac.uk

3.00 score 17 exports 4 dependencies

Last updated 1 days agofrom:c72f9763d7. Checks:2 OK. Indexed: no.

TargetResultLatest binary
Doc / VignettesOKFeb 05 2025
R-4.5-linuxOKFeb 05 2025

Exports:barker_proposalbimodal_barker_proposalchain_statecovariance_shape_adapterdual_averaging_scale_adapterexample_gaussian_stan_modelhamiltonian_proposallangevin_proposalrandom_walk_proposalrobust_shape_adaptersample_chainscale_adaptershape_adapterstochastic_approximation_scale_adaptertarget_distribution_from_log_density_formulatarget_distribution_from_stan_modelvariance_shape_adapter

Dependencies:latticeMatrixrlangwithr

Adjusting the noise distribution in the Barker proposal

Rendered fromadjusting-noise-distribution.Rmdusingknitr::rmarkdownon Feb 05 2025.

Last update: 2025-02-04
Started: 2025-02-04

Robust gradient-based MCMC with the Barker proposal

Rendered frombarker-proposal.Rmdusingknitr::rmarkdownon Feb 05 2025.

Last update: 2025-02-04
Started: 2025-02-04

Readme and manuals

Help Manual

Help pageTopics
Create a new Barker proposal object.barker_proposal
Create a new Barker proposal object with bimodal noise distribution.bimodal_barker_proposal
Construct a new chain state.chain_state
Create object to adapt proposal with shape based on estimate of target distribution covariance matrix.covariance_shape_adapter
Create object to adapt proposal scale to coerce average acceptance rate using dual averaging scheme of Nesterov (2009) and Hoffman and Gelman (2014).dual_averaging_scale_adapter
Construct an example BridgeStan 'StanModel' object for a Gaussian model.example_gaussian_stan_model
Create a new Hamiltonian proposal object.hamiltonian_proposal
Create a new Langevin proposal object.langevin_proposal
Create a new (Gaussian) random walk proposal object.random_walk_proposal
Create object to adapt proposal shape (and scale) using robust adaptive Metropolis algorithm of Vihola (2012).robust_shape_adapter
Sample a Markov chainsample_chain
Create object to adapt proposal scale to coerce average acceptance rate.scale_adapter
Create object to adapt proposal shape.shape_adapter
Create object to adapt proposal scale to coerce average acceptance rate using a Robbins and Monro (1951) scheme.stochastic_approximation_scale_adapter
Construct target distribution from a formula specifying log density.target_distribution_from_log_density_formula
Construct target distribution from a BridgeStan 'StanModel' object.target_distribution_from_stan_model
Create object to adapt proposal with per dimension scales based on estimates of target distribution variances.variance_shape_adapter