hmc_neal_2010 | R Documentation |
This function implements the Hamiltonian Monte Carlo algorithm as described by Radford M. Neal (2010) in "MCMC using Hamiltonian dynamics", which is a part of the Handbook of Markov Chain Monte Carlo. The method uses Hamiltonian dynamics to propose new positions and then applies the Metropolis criterion to decide whether to accept or reject the new position.
hmc_neal_2010(
neg_log_den_func,
neg_log_den_grad_func,
leapfrog_stepsize,
leapfrog_step,
current_pos
)
neg_log_den_func |
A function that evaluates the negative log of the density (potential energy) of the distribution to be sampled, including any constants. |
neg_log_den_grad_func |
A function that computes the gradient of
|
leapfrog_stepsize |
A numeric value specifying the step size for the leapfrog integration method. |
leapfrog_step |
A numeric value specifying the number of leapfrog steps to take to propose a new state. |
current_pos |
A numeric vector representing the current position (state) of the system. |
This function was written for illustrative purposes. More elaborate on Radford M. Neal's personal webpage (http://www.cs.utoronto.ca/~radford/).
A list containing the following elements:
position
: The position of the system after the leapfrog steps, which is
the proposed new position if accepted, or the current position
if rejected.
potential_energy
: The potential energy of the proposed position.
accepted
: A logical value indicating whether the proposal was accepted
(TRUE) or rejected (FALSE).
Neal, R. M. (2012). MCMC using Hamiltonian dynamics. arXiv:1206.1901. Available at: https://arxiv.org/pdf/1206.1901
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.