hmc {rhmc}R Documentation

Hamiltonian Monte Carlo

Description

Performs Hamiltonian Monte Carlo for a desired target function.

Usage

hmc(f, init, numit, L, eps, mass)

Arguments

f

Minus log-density function of interest.

init

Initial point for the algorithm.

numit

Number of iterations.

L

Leapfrog parameter: number of steps.

eps

Leapfrog parameter: size of each step.

mass

Mass vector.

Value

A list with the chain with the samples of interest, the values of the log-density calculated at each step and the acceptance rate.

Examples

f = function(x) -dnorm(x, 20, 10, log = TRUE)
hmc(f, 19, 1000, 16, 0.3, 0.1)


[Package rhmc version 1.0.0 Index]