Simulation studies are used to evaluate and compare the properties of statistical methods in controlled experimental settings. In most cases, performing a simulation study requires knowledge of the true value of the parameter, or estimand, of interest. However, in many simulation designs, the true value of the estimand is difficult to compute analytically. Here, we illustrate the use of Monte Carlo integration to compute true estimand values in simple and complex simulation designs. We provide general pseudocode that can be replicated in any software program of choice to demonstrate key principles in using Monte Carlo integration in two scenarios: a simple three variable simulation where interest lies in the marginally adjusted odds ratio; and a more complex causal mediation analysis where interest lies in the controlled direct effect in the presence of mediator-outcome confounders affected by the exposure. We discuss general strategies that can be used to minimize Monte Carlo error, and to serve as checks on the simulation program to avoid coding errors. R programming code is provided illustrating the application of our pseudocode in these settings.
翻译:仿真研究用于在受控实验环境中评估和比较统计方法的特性。在多数情况下,执行仿真研究需要已知目标参数或估计量的真实值。然而,在许多仿真设计中,估计量的真实值难以通过解析方法计算。本文阐述了如何运用蒙特卡罗积分来计算简单及复杂仿真设计中的真实估计量数值。我们提供了通用伪代码,可在任意选定的软件程序中复现,以演示在两种场景下使用蒙特卡罗积分的核心原则:其一是关注边缘调整比值比的简单三变量仿真;其二是在存在受暴露影响的 mediator-outcome 混杂因素时,关注受控直接效应的更复杂因果中介分析。我们讨论了可用于最小化蒙特卡罗误差的通用策略,并提供了检验仿真程序以避免编码错误的方法。文中附带的R语言代码展示了所提伪代码在这些场景中的具体应用。