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.
翻译:The Metropolis算法是一种马尔可夫链蒙特卡洛(MCMC)算法,用于从感兴趣的参数分布(如广义线性模型参数)中进行模拟。“Metropolis步骤”是构成经典及现代MCMC方法基础的关键概念,有助于简化复杂统计模型的分析。除了贝叶斯分析外,MCMC还可用于生成不确定性区间,即使在因果推断的常见情景中(目标参数并非直接由单个拟合统计模型估计)也是如此。我们通过一个具体示例、伪代码和R代码,演示了The Metropolis算法的基本机制。我们运用该算法估计了暴露于高、低水平磁场环境下儿童患白血病风险的比值比和风险差。这种方法可用于贝叶斯和频率学派框架下的推断,且在小样本情况下,相较于自助法等大样本方法具有优势。