{"title":"Demystifying Monte Carlo methods in R: A guide from Metropolis–Hastings to Hamiltonian Monte Carlo with biological growth equation examples","authors":"Dipali Vasudev Mestry, Amiya Ranjan Bhowmick","doi":"10.1016/j.ecolmodel.2024.110922","DOIUrl":null,"url":null,"abstract":"<div><div>Hamiltonian Monte Carlo (HMC) has emerged as a cutting-edge and versatile Markov Chain Monte Carlo (MCMC) method, widely adopted across various disciplines due to its superior computational efficiency compared to other MCMC techniques. Over the past few decades, HMC has gained significant traction. However, its implementation can pose challenges for practitioners, as it relies on concepts rooted in Hamiltonian dynamics from classical mechanics. Despite the development of modern Bayesian computation tools like <span><math><mstyle><mi>S</mi><mi>t</mi><mi>a</mi><mi>n</mi></mstyle></math></span>, which facilitate the application of HMC, the underlying mechanics may remain opaque to beginners. This article seeks to provide a clear and accessible introduction to HMC. We begin by reviewing the Metropolis–Hastings (MH) algorithm and its limitations, illustrated with simulated data. We then methodically explain the HMC algorithm through step-by-step simulation examples, showcasing its implementation in <span><math><mstyle><mi>R</mi></mstyle></math></span> software. Finally, we present a series of ecological case studies spanning a broad range of applications, including both single-species and multispecies dynamics. These studies demonstrate the implementation of HMC using the <span><math><mstyle><mi>r</mi><mi>s</mi><mi>t</mi><mi>a</mi><mi>n</mi></mstyle></math></span> package in <span><math><mstyle><mi>R</mi></mstyle></math></span>, applied to both simulated and real-world data. By adopting this pedagogical approach, we aim to help newcomers better understand and apply HMC to their research domains with confidence.</div></div>","PeriodicalId":51043,"journal":{"name":"Ecological Modelling","volume":"501 ","pages":"Article 110922"},"PeriodicalIF":2.6000,"publicationDate":"2025-02-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Ecological Modelling","FirstCategoryId":"93","ListUrlMain":"https://www.sciencedirect.com/science/article/pii/S0304380024003107","RegionNum":3,"RegionCategory":"环境科学与生态学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q2","JCRName":"ECOLOGY","Score":null,"Total":0}
引用次数: 0
Abstract
Hamiltonian Monte Carlo (HMC) has emerged as a cutting-edge and versatile Markov Chain Monte Carlo (MCMC) method, widely adopted across various disciplines due to its superior computational efficiency compared to other MCMC techniques. Over the past few decades, HMC has gained significant traction. However, its implementation can pose challenges for practitioners, as it relies on concepts rooted in Hamiltonian dynamics from classical mechanics. Despite the development of modern Bayesian computation tools like , which facilitate the application of HMC, the underlying mechanics may remain opaque to beginners. This article seeks to provide a clear and accessible introduction to HMC. We begin by reviewing the Metropolis–Hastings (MH) algorithm and its limitations, illustrated with simulated data. We then methodically explain the HMC algorithm through step-by-step simulation examples, showcasing its implementation in software. Finally, we present a series of ecological case studies spanning a broad range of applications, including both single-species and multispecies dynamics. These studies demonstrate the implementation of HMC using the package in , applied to both simulated and real-world data. By adopting this pedagogical approach, we aim to help newcomers better understand and apply HMC to their research domains with confidence.
期刊介绍:
The journal is concerned with the use of mathematical models and systems analysis for the description of ecological processes and for the sustainable management of resources. Human activity and well-being are dependent on and integrated with the functioning of ecosystems and the services they provide. We aim to understand these basic ecosystem functions using mathematical and conceptual modelling, systems analysis, thermodynamics, computer simulations, and ecological theory. This leads to a preference for process-based models embedded in theory with explicit causative agents as opposed to strictly statistical or correlative descriptions. These modelling methods can be applied to a wide spectrum of issues ranging from basic ecology to human ecology to socio-ecological systems. The journal welcomes research articles, short communications, review articles, letters to the editor, book reviews, and other communications. The journal also supports the activities of the [International Society of Ecological Modelling (ISEM)](http://www.isemna.org/).