← Back to Main Index Open Learning Roadmap

Causal Inference & Confounding in Health ML

Prediction models estimate what is likely to happen. Causal inference asks what would happen if we changed care, policy, screening, exposure, or treatment. This guide helps health ML learners separate useful prediction from credible causal claims.

Level Advanced healthcare topic
Best after Bias, validation, and model interpretability
Core skill Drawing assumptions before modeling
Predict Who is high risk?
Explain Which features drove this model output?
Cause What changes if we intervene?

The gap this page fills

Health ML courses often teach accuracy, calibration, fairness, and explainability, but students still need a bridge to causal reasoning. A model can find strong associations that are not treatment effects. Causal inference adds explicit assumptions about why variables are connected.

Association

Patterns in observed data

  • People with a feature have a different outcome rate.
  • Useful for risk prediction and triage.
  • Can be distorted by who received care and who was measured.
Causal effect

Change under an intervention

  • Compares potential outcomes under different actions.
  • Requires assumptions, study design, or randomization.
  • Answers treatment, policy, screening, and prevention questions.
Target trial

Design before modeling

  • Specify eligibility, treatment strategies, time zero, follow-up, and outcome.
  • Then emulate that design with observational data if a trial is not available.
  • Reduces ambiguity before algorithm choice.

Prediction questions are not causal questions

Prediction

Who is likely to have the outcome?

Useful for risk stratification, screening, triage, and workload planning.

  • Target: future labels or probabilities.
  • Main checks: discrimination, calibration, precision, recall, and external validation.
  • Feature importance explains model behavior, not clinical cause.
Causation

What happens if we intervene?

Useful for treatment choice, screening policy, prevention, and service redesign.

  • Target: counterfactual outcome under another action.
  • Main checks: exchangeability, positivity, consistency, and correct timing.
  • Adjustment choices come from subject-matter knowledge, not only prediction accuracy.
Decision

Which evidence supports action?

Sometimes a predictive model supports a decision pathway, but it still needs causal or trial evidence for treatment benefit.

  • Risk model: "This patient is high risk."
  • Causal claim: "This intervention lowers risk for this patient."
  • Clinical pathway: "Use both pieces of evidence responsibly."

Core causal structures

Directed acyclic graphs, often called DAGs, are compact diagrams of assumptions. They do not prove causality by themselves, but they make hidden assumptions discussable.

Confounder

Severity -> Treatment -> Outcome Severity -> Outcome

Severity affects both treatment choice and outcome. Adjust for it when estimating the treatment effect.

Mediator

Treatment -> Blood Pressure -> Stroke

A mediator is on the pathway from exposure to outcome. Adjusting for it can remove part of the effect.

Collider

Disease -> Hospital Visit <- Frailty

Conditioning on a common effect can create a false association between its causes.

Interactive confounding simulator

In this example, sicker patients are more likely to receive a treatment. The treatment can reduce risk within each severity stratum and still look harmful in the raw data if treated patients are much sicker at baseline.

Outcome risk among untreated low-severity patients.
How much high severity increases outcome risk.
Positive values reduce risk within each severity group.
Higher values mean treatment is preferentially given to sicker patients.
+9.0% Raw treated minus untreated risk
-8.0% Severity-standardized effect
27.5% Observed treated risk
18.5% Observed untreated risk
The raw comparison is confounded because the treated group has more high-severity patients. Standardizing severity recovers the within-stratum treatment contrast.

Adjustment set practice

Choose the variables you would adjust for to estimate the effect of an exposure on an outcome. The goal is not to include every available feature. The goal is to block backdoor paths without blocking the causal pathway or opening collider paths.

Treatment

Statin use and heart attack

Older, high-risk patients are more likely to receive statins and more likely to have heart attacks.

Screening

Screening and survival

Screening can change diagnosis timing before it changes true disease course.

Selection

Disease and frailty in hospital data

Analysis is restricted to hospitalized patients, a common effect of disease and frailty.

Statin use and heart attack

Estimate the causal effect of statin use on heart attack risk.

A practical causal workflow for health ML projects

1

Write the causal question

  • Exposure or intervention
  • Outcome and follow-up window
  • Population and time zero
2

Sketch assumptions

  • Draw a DAG with domain experts
  • Mark confounders, mediators, colliders, and selection processes
3

Choose adjustment variables

  • Block confounding paths
  • Avoid post-exposure variables unless the estimand requires them
4

Check measurement and positivity

  • Can every subgroup receive each treatment strategy?
  • Are key confounders measured before exposure?
5

Estimate transparently

  • Use regression, matching, weighting, g-computation, or doubly robust methods
  • Report target estimand and assumptions
6

Stress test the conclusion

  • Run sensitivity analyses
  • Compare with negative controls or external evidence when available

Common mistakes to avoid

Calling feature importance causal

A feature can improve prediction because it is a proxy, consequence, or measurement artifact.

Adjusting for everything

More covariates are not always better. Mediators and colliders can bias causal estimates.

Ignoring time zero

Exposure, eligibility, confounders, and outcome follow-up must be aligned in time.

Forgetting selection bias

EHR and hospital cohorts often include people because something already happened.

Rule of thumb: Use ML freely for prediction, nuisance modeling, and flexible adjustment, but make causal claims only when the study design and assumptions support them.

Quick self-check

Use these short cases to confirm the core distinctions.

Case 1

A sepsis risk model gives high importance to "vasopressor use." Can you conclude vasopressors cause sepsis?

Correct answer: No. Vasopressor use may indicate severe illness or treatment after deterioration.

Case 2

Which variable should usually be considered for adjustment when estimating a treatment effect?

Correct answer: Pre-treatment severity. Adjust for common causes measured before treatment.

Case 3

A model predicts mortality well. What extra evidence is needed before claiming a new alert will save lives?

Correct answer: Impact or causal evidence. Prediction performance alone does not prove the alert changes outcomes.

How this connects to other portal pages

With interpretability

Use the interpretability guide to inspect model behavior, then use causal thinking before making intervention claims.

With bias and fairness

Use the bias guide to think about selection, measurement, and group harms that may affect causal conclusions.

With external validation

Use the transportability guide before applying causal or clinical claims in a new setting.

Key takeaway

Prediction answers "who is likely to have the outcome?" Causal inference answers "what would happen if we changed something?" Health ML needs both, but they require different assumptions, validation checks, and reporting language.