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.
翻译:模拟研究用于在受控实验环境下评估和比较统计方法的性质。在大多数情况下,执行模拟研究需要了解目标参数或估计量的真实值。然而,在许多模拟设计中,估计量的真实值难以通过解析方法计算。本文阐述了在简单和复杂模拟设计中,如何使用蒙特卡洛积分来计算估计量的真实值。我们提供了通用伪代码,可在任意选定的软件程序中复现,以演示在两种场景下使用蒙特卡洛积分的关键原则:一是关注边际调整比值比的简单三变量模拟;二是在存在受暴露影响的中介-结局混杂因素时,关注受控直接效应的更复杂的因果中介分析。我们讨论了可用于最小化蒙特卡洛误差的通用策略,并作为模拟程序的检查手段以避免编码错误。同时提供了R编程代码,以展示我们的伪代码在这些场景中的应用。