Perform Hamiltonian Monte Carlo with dual averaging

hmc_da_helper(
  log_posterior,
  gradient,
  n_steps,
  init_parameters,
  iters,
  warmup_iters = iters/2,
  logging = TRUE
)

Arguments

log_posterior

a function for the unnormalised log-posterior from parameters -> log-likelihood

gradient

the gradient of the log_posterior

n_steps

the number of leapfrog steps

init_parameters

a named vector containing the initial parameters

iters

the number of iterations

warmup_iters

the total number of warmup iterations to use for the adaptation phase

logging

enable logging

Value

a matrix of iterations from the HMC algorithm representing draws from the posterior distribution