» Articles » PMID: 34713468

Introduction to Computational Causal Inference Using Reproducible Stata, R, and Python Code: A Tutorial

Overview
Journal Stat Med
Publisher Wiley
Specialty Public Health
Date 2021 Oct 29
PMID 34713468
Citations 19
Authors
Affiliations
Soon will be listed here.
Abstract

The main purpose of many medical studies is to estimate the effects of a treatment or exposure on an outcome. However, it is not always possible to randomize the study participants to a particular treatment, therefore observational study designs may be used. There are major challenges with observational studies; one of which is confounding. Controlling for confounding is commonly performed by direct adjustment of measured confounders; although, sometimes this approach is suboptimal due to modeling assumptions and misspecification. Recent advances in the field of causal inference have dealt with confounding by building on classical standardization methods. However, these recent advances have progressed quickly with a relative paucity of computational-oriented applied tutorials contributing to some confusion in the use of these methods among applied researchers. In this tutorial, we show the computational implementation of different causal inference estimators from a historical perspective where new estimators were developed to overcome the limitations of the previous estimators (ie, nonparametric and parametric g-formula, inverse probability weighting, double-robust, and data-adaptive estimators). We illustrate the implementation of different methods using an empirical example from the Connors study based on intensive care medicine, and most importantly, we provide reproducible and commented code in Stata, R, and Python for researchers to adapt in their own observational study. The code can be accessed at https://github.com/migariane/Tutorial_Computational_Causal_Inference_Estimators.

Citing Articles

Guidelines and Best Practices for the Use of Targeted Maximum Likelihood and Machine Learning When Estimating Causal Effects of Exposures on Time-To-Event Outcomes.

Talbot D, Diop A, Mesidor M, Chiu Y, Sirois C, Spieker A Stat Med. 2025; 44(6):e70034.

PMID: 40079648 PMC: 11905698. DOI: 10.1002/sim.70034.


So Many Choices: A Guide to Selecting Among Methods to Adjust for Observed Confounders.

Keele L, Grieve R Stat Med. 2025; 44(5):e10336.

PMID: 39947224 PMC: 11825193. DOI: 10.1002/sim.10336.


Interaction between opium use and cigarette smoking on bladder cancer: An inverse probability weighting approach based on a multicenter case-control study in Iran.

Akrami R, Hadji M, Rashidian H, Nazemipour M, Naghibzadeh-Tahami A, Ansari-Moghaddam A Glob Epidemiol. 2025; 9():100182.

PMID: 39846054 PMC: 11751544. DOI: 10.1016/j.gloepi.2024.100182.


Comparative effectiveness of laparoscopic versus open colectomy in colon cancer patients: a study protocol for emulating a target trial using cancer registry data.

Abera S, Robers G, Kastner A, Stentzel U, Weitmann K, Hoffmann W J Cancer Res Clin Oncol. 2025; 151(1):34.

PMID: 39798018 PMC: 11724780. DOI: 10.1007/s00432-024-06057-x.


Machine learning in causal inference for epidemiology.

Moccia C, Moirano G, Popovic M, Pizzi C, Fariselli P, Richiardi L Eur J Epidemiol. 2024; 39(10):1097-1108.

PMID: 39535572 PMC: 11599438. DOI: 10.1007/s10654-024-01173-x.


References
1.
Naimi A, Mishler A, Kennedy E . Challenges in Obtaining Valid Causal Effect Estimates with Machine Learning Algorithms. Am J Epidemiol. 2021; 192(9). DOI: 10.1093/aje/kwab201. View

2.
Rubin D . The design versus the analysis of observational studies for causal effects: parallels with the design of randomized trials. Stat Med. 2006; 26(1):20-36. DOI: 10.1002/sim.2739. View

3.
Bang H, Robins J . Doubly robust estimation in missing data and causal inference models. Biometrics. 2006; 61(4):962-73. DOI: 10.1111/j.1541-0420.2005.00377.x. View

4.
Jung K, Lee J, Gupta V, Cho G . Comparison of Bootstrap Confidence Interval Methods for GSCA Using a Monte Carlo Simulation. Front Psychol. 2019; 10:2215. PMC: 6797821. DOI: 10.3389/fpsyg.2019.02215. View

5.
Luque-Fernandez M, Belot A, Valeri L, Cerulli G, Maringe C, Rachet B . Data-Adaptive Estimation for Double-Robust Methods in Population-Based Cancer Epidemiology: Risk Differences for Lung Cancer Mortality by Emergency Presentation. Am J Epidemiol. 2017; 187(4):871-878. PMC: 5888939. DOI: 10.1093/aje/kwx317. View