  Hamiltonian Monte Carlo (HMC) is a powerful tool for Bayesian computation. In
comparison with the traditional Metropolis-Hastings algorithm, HMC offers
greater computational efficiency, especially in higher dimensional or more
complex modeling situations. To most statisticians, however, the idea of HMC
comes from a less familiar origin, one that is based on the theory of classical
mechanics. Its implementation, either through Stan or one of its derivative
programs, can appear opaque to beginners. A lack of understanding of the inner
working of HMC, in our opinion, has hindered its application to a broader range
of statistical problems. In this article, we review the basic concepts of HMC
in a language that is more familiar to statisticians, and we describe an HMC
implementation in R, one of the most frequently used statistical software
environments. We also present hmclearn, an R package for learning HMC. This
package contains a general-purpose HMC function for data analysis. We
illustrate the use of this package in common statistical models. In doing so,
we hope to promote this powerful computational tool for wider use. Example code
for common statistical models is presented as supplementary material for online
publication.
