mcmc-0.8.2.0: Sample from a posterior using Markov chain Monte Carlo
Copyright2021 Dominik Schrempf
LicenseGPL-3.0-or-later
Maintainerdominik.schrempf@gmail.com
Stabilityexperimental
Portabilityportable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Mcmc.Proposal.Hamiltonian.Hamiltonian

Description

Creation date: Mon Jul 5 12:59:42 2021.

The Hamiltonian Monte Carlo (HMC) proposal.

The HMC proposal acts on Positions, a vector of floating point values. The manipulated values can represent the complete state, or a subset of the complete state. Functions converting the state to and from this vector have to be provided; see HStructure.

Even though the proposal may only act on a subset of the complete state, the prior, likelihood, and Jacobian functions of the complete state have to be provided; see HTarget. This is because parameters not manipulated by the HMC proposal still influence the prior, likelihood and Jacobian functions.

The points given above have implications on how the HMC proposal is handled: Do not use liftProposalWith, liftProposal, or (@~) with the HMC proposal; instead provide proper conversion functions with HStructure.

The gradient of the log target function is calculated using automatic differentiation; see the excellent ad package.

The desired acceptance rate is 0.65, although the dimension of the proposal is high.

The speed of this proposal changes drastically with the leapfrog trajectory length and the leapfrog scaling factor. Hence, the speed will change during burn in.

References:

  • [1] Chapter 5 of Handbook of Monte Carlo: Neal, R. M., MCMC Using Hamiltonian Dynamics, In S. Brooks, A. Gelman, G. Jones, & X. Meng (Eds.), Handbook of Markov Chain Monte Carlo (2011), CRC press.
  • [2] Gelman, A., Carlin, J. B., Stern, H. S., & Rubin, D. B., Bayesian data analysis (2014), CRC Press.
  • [3] Review by Betancourt and notes: Betancourt, M., A conceptual introduction to Hamiltonian Monte Carlo, arXiv, 1701–02434 (2017).
  • [4] Matthew D. Hoffman, Andrew Gelman (2014) The No-U-Turn Sampler: Adaptively Setting Path Lengths in Hamiltonian Monte Carlo, Journal of Machine Learning Research.
Synopsis

Hamiltonian Monte Carlo proposal

data HParams Source #

Parameters of the Hamilton Monte Carlo proposal.

If a parameter is Nothing, a default value is used (see defaultHParams).

Instances

Instances details
Show HParams Source # 
Instance details

Defined in Mcmc.Proposal.Hamiltonian.Hamiltonian

defaultHParams :: HParams Source #

Default parameters.

  • Estimate a reasonable leapfrog scaling factor using Algorithm 4 [4]. If all fails, use 0.1.
  • Leapfrog simulation length is set to 0.5.
  • The mass matrix is set to the identity matrix.

hamiltonian :: Traversable s => HParams -> HTuningConf -> HStructure s -> HTarget s -> PName -> PWeight -> Proposal (s Double) Source #

Hamiltonian Monte Carlo proposal.

The structure of the state is denoted as s.

May call error during initialization.