# SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.stats.random.rng.multivariate.mcmc.hybrid

## Class AbstractHybridMCMC

• All Implemented Interfaces:
RandomVectorGenerator, Seedable
Direct Known Subclasses:
HybridMCMC, MultipointHybridMCMC

public abstract class AbstractHybridMCMC
extends AbstractMetropolis
Hybrid Monte Carlo, or Hamiltonian Monte Carlo, is a method that combines the traditional Metropolis algorithm, with molecular dynamics simulation. The idea is to make use of the equations from classical mechanics, to guide our choice of proposed state. At each step we generate a random momentum vector, where each component is drawn from a Gaussian distribution. Considering the target density as the potential energy field of the system and the current state as the initial position of the molecules, we perform a molecular dynamics simulation (using the LeapFrogging algorithm) for the given time period. The final position of the molecules is taken as the next proposed state. The acceptance-rejection decision is then done like as in the classical Metropolis algorithm.
• ### Field Summary

Fields
Modifier and Type Field and Description
protected double dt
• ### Constructor Summary

Constructors
Constructor and Description
AbstractHybridMCMC(Vector initialState, RandomNumberGenerator rng)
Constructs a new instance with the given parameters.
• ### Method Summary

All Methods
Modifier and Type Method and Description
static RealVectorFunction dUdx(RealVectorFunction dLogF)
Gets the derivative of the potential function, given the derivative of the log density.
static double H(LeapFrogging.DynamicsState state, RealScalarFunction logF, Vector m)
Evaluates a system's total energy at a given state.
static double k(Vector p, Vector m)
Evaluates the standard kinetic energy, k = p^2 / 2m.
void setDeltaT(double dt)
Sets the value of dt that will be used in the subsequent iterations.
• ### Methods inherited from class com.numericalmethod.suanshu.stats.random.rng.multivariate.mcmc.metropolis.AbstractMetropolis

acceptanceRate, isProposalAccepted, nextProposedState, nextVector, seed
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### Field Detail

• #### dt

protected double dt
• ### Constructor Detail

• #### AbstractHybridMCMC

public AbstractHybridMCMC(Vector initialState,
RandomNumberGenerator rng)
Constructs a new instance with the given parameters.
Parameters:
initialState - the initial state of the algorithm
rng - a random number generator
• ### Method Detail

• #### setDeltaT

public final void setDeltaT(double dt)
Sets the value of dt that will be used in the subsequent iterations. This is useful for varying the time step size between iterations.
Parameters:
dt - the value of dt
• #### dUdx

public static RealVectorFunction dUdx(RealVectorFunction dLogF)
Gets the derivative of the potential function, given the derivative of the log density.
Parameters:
dLogF - the derivative of the log density, density logF = -U(x)
Returns:
the derivative of the potential function
• #### H

public static double H(LeapFrogging.DynamicsState state,
RealScalarFunction logF,
Vector m)
Evaluates a system's total energy at a given state.
Parameters:
state - the state of the system
logF - the log-density function, -U(x)
m - the mass of the components
Returns:
the total energy, H(x, p)
• #### k

public static double k(Vector p,
Vector m)
Evaluates the standard kinetic energy, k = p^2 / 2m.
Parameters:
p -
m -
Returns:
k