Step-by-step causal analysis of Electronic Health Records to ground decision making

Matthieu Doutreligne, Tristan Struja, J. Abécassis, Claire Morgand, Gaël Varoquaux, Leo Anthony CeliResearch Square 2023 · DOI

Abstract

Accurate predictions, as with machine learning, may not suffice to provide optimal healthcare for every patient. Indeed, prediction can be driven by shortcuts in the data, such as racial biases. Causal thinking is needed for data-driven decisions. Here, we give an introduction to the key elements, focusing on routinely-collected data, electronic health records (EHRs) and claims data. Using such data to assess the value of an intervention requires care: temporal dependencies and existing practices easily confound the causal effect. We present a step-by-step framework to help build valid decision making from real-life patient records by emulating a randomized trial before individualizing decisions, eg with machine learning. Our framework highlights the most important pitfalls and considerations in analysing EHRs or claims data to draw causal conclusions. We illustrate the various choices in studying the effect of albumin on sepsis mortality in the Medical Information Mart for Intensive Care database (MIMIC-IV). We study the impact of various choices at every step, from feature extraction to causal-estimator selection. In a tutorial spirit, the code and the data are openly available.

Introduction: Beyond Prediction

In modern healthcare, machine learning models have achieved remarkable accuracy in predicting patient outcomes. However, a high-performing predictive model does not inherently support clinical decision-making. Predictive models often exploit statistical correlations—"shortcuts"—that do not imply causation. For instance, a model might associate a specific drug with improved survival simply because clinicians only prescribe it to stable patients who were already likely to survive.

While Randomized Controlled Trials (RCTs) remain the gold standard for establishing efficacy, they are often slow, costly, and exclude the complex, multi-morbid patients frequently encountered in clinical practice. Causal inference offers a bridge, allowing researchers to use observational Electronic Health Record (EHR) data to answer "what-if" questions safely. This paper presents a structured framework for Target Trial Emulation to derive actionable insights from messy real-world data.

A Five-Step Framework for Causal Analysis

To ensure rigorous causal conclusions, we propose a five-step framework that guides researchers from initial question framing to individualized treatment effects.

The five-step framework for causal analysis: Framing, Identification, Estimation, Vibration Analysis, and Conditional Average Treatment Effect (CATE).
  1. Framing (PICO-T): The first step involves defining the Population, Intervention, Control, Outcome, and—crucially—the Time component. Temporal framing is critical in EHR data to avoid biases.
  2. Identification: Researchers must use Directed Acyclic Graphs (DAGs) to identify confounders (variables affecting both treatment and outcome). Distinguishing these from mediators or colliders is essential to avoid introducing bias during adjustment.
  3. Estimation: This step moves beyond simple regression to causal estimators like Inverse Propensity Weighting (IPW) and Doubly Robust methods. These techniques help balance the data, making treated and untreated groups comparable.
  4. Vibration Analysis: This sensitivity analysis assesses how results "vibrate" (change) based on technical choices, such as data aggregation methods or the choice of "nuisance" estimators (e.g., linear regression vs. neural networks).
  5. Treatment Heterogeneity: Finally, Conditional Average Treatment Effect (CATE) analysis identifies which specific subgroups benefit most from an intervention, moving beyond population averages to personalized medicine.

Handling EHR Data and Temporal Dependencies

A primary challenge in EHR analysis is the temporal nature of the data. Causal models must strictly utilize pre-treatment covariates to avoid "immortal time bias." This bias occurs when inclusion criteria require a patient to survive long enough to receive a treatment, which artificially inflates the treatment's perceived benefit by excluding those who died early.

Illustration of patient covariates (X) collected over time (T0-T3) prior to the inclusion date and intervention (A), leading to potential outcomes (Y).

As shown in the patient timeline, covariates such as age, gender, and physiological markers (e.g., SOFA score, SpO2) must be captured before the intervention $A$ is administered. Aggregation functions (min, max, first, last) are then used to transform these time-series features into a static feature vector $x$ for estimation.

Case Study: Albumin for Sepsis

We applied this framework to the MIMIC-IV database to study the effect of adding albumin to resuscitation fluids for septic patients. Analyzing 18,421 patients, we found:

  • Average Effect: Consistent with major RCTs (like the SAFE study), there was no significant average benefit of albumin on 28-day mortality for the general sepsis population.
  • Subgroup Benefits: CATE analysis revealed protective effects in high-risk groups, including patients in septic shock, those aged 60 or older, and male patients.
  • Bias Detection: We successfully demonstrated that extending the observation window into the post-treatment period artificially inflated albumin's benefit, highlighting the danger of immortal time bias in clinical research.

Conclusion

Causal inference from EHRs requires more than just powerful algorithms; it requires a disciplined approach to data structure and bias mitigation. By emulating the structure of a randomized trial, researchers can turn observational records into a powerful tool for personalized medicine. While limited by the "unconfoundedness" assumption—the requirement that all relevant variables are measured—this framework provides a robust path toward evidence-based clinical decisions.

Summary updated

Abstract

<title>Abstract</title> Accurate predictions, as with machine learning, may not suffice to provide optimal healthcare for every patient. Indeed, prediction can be driven by shortcuts in the data, such as racial biases. Causal thinking is needed for data-driven decisions. Here, we give an introduction to the key elements, focusing on routinely-collected data, electronic health records (EHRs) and claims data. Using such data to assess the value of an intervention requires care: temporal dependencies and existing practices easily confound the causal effect. We present a step-by-step framework to help build valid decision making from real-life patient records by emulating a randomized trial before individualizing decisions, eg with machine learning. Our framework highlights the most important pitfalls and considerations in analysing EHRs or claims data to draw causal conclusions. We illustrate the various choices in studying the effect of albumin on sepsis mortality in the Medical Information Mart for Intensive Care database (MIMIC-IV). We study the impact of various choices at every step, from feature extraction to causal-estimator selection. In a tutorial spirit, the code and the data are openly available.
BibTeX
@inproceedings{doutreligne2023step,
  author = {Matthieu Doutreligne and Tristan Struja and J. Abécassis and Claire Morgand and Gaël Varoquaux and Leo Anthony Celi},
  title = {{Step-by-step causal analysis of Electronic Health Records to ground decision making}},
  booktitle = {Research Square},
  year = {2023},
  doi = {10.21203/rs.3.rs-3222036/v1},
}
Figure