A treatment can affect an outcome through more than one route. Mediation analysis is the Structural Causal Model (SCM) machinery for separating the effect that flows through a specific intermediate variable from the effect that does not.
The decomposition lives outside the three-rung hierarchy because the natural direct and natural indirect effects are defined by nested counterfactuals — queries that simultaneously hold one variable at its actual value while imagining another at a counterfactual value.
The question mediation answers
A drug lowers blood pressure, and patients on the drug have fewer strokes. Two questions, frequently confused:
- Does the drug reduce strokes? — the total causal effect. Rung 2 territory.
- Does the drug reduce strokes by lowering blood pressure? — the mediated effect. This is mediation.
The first question can be answered by a randomised trial alone. The second cannot. A trial proves the drug works; it does not prove why the drug works. The drug might lower blood pressure incidentally while reducing strokes through some other pathway entirely — anti-inflammatory action, vasodilation in a different vascular bed, anything. Mediation analysis is the framework for splitting the total effect into the part attributable to a hypothesized mechanism (blood pressure) and the part not attributable to it.
The intuitive move — condition on blood pressure and see whether the drug effect on strokes survives — produces a quantity that is, in general, not what you want. Conditioning on a mediator that has its own confounders introduces collider bias. The naive analysis answers a different question, often a wrong one. Mediation analysis is the principled formalization of what conditioning is supposed to be doing.
Natural direct and indirect effects
The two key quantities are due to Robins & Greenland (1992) and given their modern formulation by Pearl (2001).
Let T be a binary treatment, M a mediator, and Y the outcome. Write Y(t, M(t′)) for the counterfactual outcome under treatment t if the mediator were set to the value it would have taken under treatment t′. The two natural effects are:
Natural Direct Effect (NDE): the effect of treatment when the mediator is held at its untreated value —
NDE = E[Y(1, M(0))] − E[Y(0, M(0))]
Natural Indirect Effect (NIE): the effect that flows through the mediator, holding treatment fixed —
NIE = E[Y(1, M(1))] − E[Y(1, M(0))]
These add to the total effect: Total = NDE + NIE. The decomposition is exact, not approximate. Each term is interpretable. The NDE answers “how much would the drug help if blood pressure didn’t change?” The NIE answers “how much help comes specifically from the blood-pressure drop?”
The reason these are natural rather than controlled effects is that the mediator is set to the value it would have taken naturally under one of the two treatment arms, rather than to a fixed value chosen by the analyst. Natural effects answer the policy question (“does this drug work through this mechanism?”); controlled effects answer a different question (“what would happen if we forced blood pressure to 120/80 regardless?”).
Why this needs nested counterfactuals
Look closely at the NDE expression: Y(1, M(0)) is the outcome under active treatment with the mediator held at the value it would have taken under no treatment. This is a doubly-counterfactual world — the patient simultaneously is and is not on the drug. The expression cannot be simulated by any randomised experiment, because no experiment can give a single patient both treatments at once.
This is why mediation analysis lives outside the three-rung hierarchy in the strictest reading. Rung 3 (counterfactuals) handles single-counterfactual queries on a factual outcome. Mediation requires a nested counterfactual: imagining one variable at one counterfactual value while another is at another. The framework that supports it — the “recursive substitution” expansion of the structural equations — is a strict generalization of Rung 3.
When mediation is identifiable
A natural effect is identifiable from observational data when, on top of the usual no-unmeasured-confounding-of-the-treatment assumption, you also have:
- No unmeasured confounding of the mediator and outcome. Conditional on observed covariates, the mediator’s effect on the outcome must not be confounded by anything unmeasured.
- No mediator-outcome confounder affected by treatment. This last one is the subtle requirement that fails most often. If treatment changes a covariate that confounds the mediator-outcome relationship, the natural effects are not identifiable — not as a point estimate, not in any sample size.
VanderWeele and others have developed alternative interventional direct and indirect effects that relax this third condition. They answer slightly different questions but are identifiable in a wider class of graphs. The choice between natural and interventional decompositions is itself a substantive question for the analyst, not a technicality.
When mediation is the right tool
Mediation analysis pays off in three settings:
- Mechanism evidence for regulators. If you can show a drug works through a biological pathway you understand, the regulator extends approval to related indications more readily and trusts the safety profile more. Mediation analysis quantifies how much of the effect is mechanism-attributable versus how much is unexplained.
- Algorithmic fairness audits. The headline question of fairness work is often: “does this model treat groups differently because of attributes that legitimately predict the outcome, or through proxies for protected attributes?” That is a mediation question. Path-specific effects let you isolate “effect through legitimate predictors” from “effect through illegitimate proxies.” Standard demographic-parity metrics cannot make the distinction; mediation analysis can.
- Marketing-mix attribution and intervention design. When multiple channels feed into a customer decision, mediation analysis tells you which channels are independently moving outcomes and which are just downstream of a primary cause. Killing the downstream channel saves money without losing effect; killing the primary cause loses everything.
The honest caveat
Mediation analysis depends on the graph more than almost any other SCM technique. The decomposition is sharp, but it answers the question implicit in the graph you drew. If you put the mediator in the wrong place, or miss a confounder of the mediator-outcome relationship, the “mechanism effect” you compute is not the mechanism effect of interest — it is some other quantity, often without a useful interpretation.
This is a feature, not a bug. The discipline of drawing the graph and naming the mediator forces the analyst to commit to a specific mechanism hypothesis. A randomised trial proves the drug works; mediation analysis proves the theory of why it works — or refutes it.
References
Mediation analysis has roots in epidemiology and psychometrics going back to the 1980s, but the modern SCM-flavoured formulation begins with Robins & Greenland (1992) and Pearl (2001). VanderWeele’s 2015 monograph is the standard practitioner reference.
The original paper introducing the natural direct and indirect effect decomposition under a counterfactual framework. Epidemiology 3(2): 143–155.
The structural-equation formulation that connects mediation analysis to the broader SCM identification machinery. Introduces the “Mediation Formula” for nonparametric estimation. Proceedings of the Seventeenth Conference on Uncertainty in Artificial Intelligence (UAI), pp. 411–420.
The standard practitioner reference. Develops natural and interventional decompositions, sensitivity analysis for the mediation-specific assumptions, and worked examples across epidemiology, economics, and the social sciences. Oxford University Press.
If your model already has a hypothesized mediator, you can probably already decompose the effect. A causal audit names the mediation question your data can support.
info@rung3.ai