Thomas Samuel, Tu Wanzhu
Indiana University School of Medicine.
Am Stat. 2021;75(4):403-413. doi: 10.1080/00031305.2020.1865198. Epub 2021 Jan 31.
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.
哈密顿蒙特卡罗(HMC)是贝叶斯计算的强大工具。与传统的梅特罗波利斯-黑斯廷斯算法相比,HMC具有更高的计算效率,尤其是在高维或更复杂的建模情况下。然而,对大多数统计学家来说,HMC的概念源于一个不太熟悉的领域,即基于经典力学理论。通过斯坦(Stan)或其衍生程序之一来实现HMC,对于初学者来说可能显得晦涩难懂。我们认为,对HMC内部工作原理的缺乏理解阻碍了它在更广泛的统计问题中的应用。在本文中,我们用统计学家更熟悉的语言回顾了HMC的基本概念,并描述了在R(最常用的统计软件环境之一)中的HMC实现。我们还展示了hmclearn,一个用于学习HMC的R包。这个包包含一个用于数据分析的通用HMC函数。我们说明了该包在常见统计模型中的使用。通过这样做,我们希望推广这个强大的计算工具以供更广泛地使用。常见统计模型的示例代码作为在线发表的补充材料呈现。