The Metropolis algorithm is a Markov chain Monte Carlo (MCMC) algorithm used to simulate from parameter distributions of interest, such as generalized linear model parameters. The "Metropolis step" is a keystone concept that underlies classical and modern MCMC methods and facilitates simple analysis of complex statistical models. Beyond Bayesian analysis, MCMC is useful for generating uncertainty intervals, even under the common scenario in causal inference in which the target parameter is not directly estimated by a single, fitted statistical model. We demonstrate, with a worked example, pseudo-code, and R code, the basic mechanics of the Metropolis algorithm. We use the Metropolis algorithm to estimate the odds ratio and risk difference contrasting the risk of childhood leukemia among those exposed to high versus low level magnetic fields. This approach can be used for inference from Bayesian and frequentist paradigms and, in small samples, offers advantages over large-sample methods like the bootstrap.
翻译:Metropolis算法是一种马尔可夫链蒙特卡洛(MCMC)算法,用于从感兴趣的参数分布(如广义线性模型参数)中进行模拟。"Metropolis步骤"是支撑经典与现代MCMC方法的核心概念,有助于简化复杂统计模型的分析。除贝叶斯分析外,MCMC还可用于生成不确定性区间,即便在因果推断的常见场景中——即目标参数并非由单一拟合的统计模型直接估计时——也是如此。我们通过一个具体实例、伪代码及R代码演示了Metropolis算法的基本机制。利用该算法,我们对比了暴露于高、低水平磁场环境中儿童患白血病的风险,并据此估计了比值比和风险差。该方法可用于贝叶斯与频率学派范式下的推断,且在小样本情境下相较于自助法等大样本方法具有优势。