Throughout most of this book we have asked: “What is the total causal effect of treatment \(A\) on outcome \(Y\)?” This question collapses all causal pathways between \(A\) and \(Y\) into a single number. But scientific and policy questions often require a finer decomposition: how much of the effect of \(A\) on \(Y\) operates through a particular intermediate variable (a mediator \(M\)), and how much operates through other pathways?
Mediation analysis has a long history in the behavioral and social sciences, but the traditional approach — based on coefficient differences in linear regression — has significant conceptual and practical limitations. This chapter examines those limitations, defends a properly formulated mediation analysis, and introduces a modern interventionist framework that resolves many of the classical difficulties.
Classical mediation analysis, as popularized by Baron and Kenny (1986), decomposes the total effect of \(A\) on \(Y\) into:
In a linear structural equation model, this decomposition is:
\[Y = \beta_0 + \beta_1 A + \beta_2 M + \varepsilon_Y, \quad M = \alpha_0 + \alpha_1 A + \varepsilon_M.\]
The indirect effect is \(\alpha_1 \cdot \beta_2\) (the “product of coefficients”) and the direct effect is \(\beta_1\). The total effect is \(\beta_1 + \alpha_1 \cdot \beta_2\).
Definition 1 (Limitations of Classical Mediation Analysis) The classical approach fails in several important ways:
These criticisms motivate a formal counterfactual definition of direct and indirect effects, which makes the identifying assumptions explicit and yields estimators that work in non-linear models with interaction.
Despite these criticisms, mediation analysis remains scientifically valuable when conducted with appropriate care. Understanding how a treatment works — through what mechanisms — is essential for:
The counterfactual framework provides precise definitions that make these scientific goals achievable without the ambiguities of the classical approach.
Definition 2 (Natural Direct Effect (NDE)) The natural direct effect of \(A\) (comparing \(a = 1\) to \(a = 0\)) is
\[\text{NDE} = \text{E}{\left[Y^{a=1, M^{a=0}}\right]} - \text{E}{\left[Y^{a=0, M^{a=0}}\right]},\]
where \(Y^{a, m}\) is the potential outcome under treatment \(a\) and mediator value \(m\), and \(M^{a=0}\) is the potential value of the mediator under no treatment. The NDE asks: what is the effect of \(A\) on \(Y\) if the mediator were “held” at the value it would have taken under no treatment?
Definition 3 (Natural Indirect Effect (NIE)) The natural indirect effect of \(A\) (comparing \(a = 1\) to \(a = 0\)) is
\[\text{NIE} = \text{E}{\left[Y^{a=1, M^{a=1}}\right]} - \text{E}{\left[Y^{a=1, M^{a=0}}\right]},\]
which captures the effect of changing the mediator from \(M^{a=0}\) to \(M^{a=1}\) while holding treatment at \(a = 1\). The NIE asks: how much of the treatment effect is attributable to the change in \(M\)?
The total effect decomposes as:
\[\text{E}{\left[Y^{a=1}\right]} - \text{E}{\left[Y^{a=0}\right]} = \text{NDE} + \text{NIE}.\]
This decomposition always holds on the additive (difference) scale. On other scales (ratio, odds ratio), decompositions exist but are more complex.
The natural direct and indirect effects require identifying assumptions that cannot be empirically verified — in particular, the cross-world consistency condition assumes that the potential outcome \(Y^{a=1, M^{a=0}}\) is well-defined and corresponds to a realizable intervention. This is conceptually problematic when the mediator \(M\) cannot in principle be manipulated independently of \(A\).
An alternative is to focus on controlled direct effects and related estimands that do not require cross-world counterfactuals.
Definition 4 (Controlled Direct Effect (CDE)) The controlled direct effect of \(A\) at mediator level \(m\) is
\[\text{CDE}(m) = \text{E}{\left[Y^{a=1, m}\right]} - \text{E}{\left[Y^{a=0, m}\right]},\]
where both \(A\) and \(M\) are set simultaneously to specified values. The CDE asks: what is the effect of \(A\) on \(Y\) when \(M\) is held at level \(m\) by external intervention?
The CDE is identified under the same conditions as the average causal effect of \(A\), plus no unmeasured \(M\)–\(Y\) confounders. Crucially, the CDE does not require the cross-world consistency assumption and does not depend on condition (4) above (no \(A\)-affected \(M\)–\(Y\) confounder).
The CDE corresponds to a physical intervention: setting \(M = m\) for everyone in the population and then comparing treatment assignments. This is the kind of intervention that could, in principle, be conducted (e.g., in a sequential randomized trial that randomizes both \(A\) and \(M\)).
The limitation of the CDE is that it does not provide a single measure of the “indirect effect”; rather, the CDE at \(m\) captures the direct effect when the mediator is fixed at \(m\), and one obtains a different CDE for each value of \(m\).
The deepest conceptual challenge in mediation analysis arises from the cross-world nature of the NDE and NIE: \(Y^{a=1, M^{a=0}}\) requires simultaneously setting \(A = 1\) (at one level) and letting \(M\) be as it would be if \(A = 0\) (a different level). This is not the result of any single intervention on \((A, M)\).
The interventionist approach resolves this by restricting attention to estimands that correspond to interventions that could actually be performed.
Definition 5 (Interventionist (Stochastic) Mediation Estimands) Let \(Q\) be a distribution over mediator values. Define the randomized interventional analogue of the indirect effect as
\[\text{rIIE} = \text{E}{\left[Y^{a=1, G_1}\right]} - \text{E}{\left[Y^{a=1, G_0}\right]},\]
where \(G_a \sim Q(M^a)\) denotes assigning the mediator at random from the distribution it would have under treatment \(a\).
In this formulation, both components of the nested counterfactual correspond to actual interventions: set \(A\) to some value and draw \(M\) from a distribution. There is no cross-world problem because we are only asking “what would happen if \(A\) were set to 1 and \(M\) were drawn from the distribution it would have under \(A = 0\)?” — which is an intervention that could be implemented.
The randomized interventional analogue of the indirect effect is identified under conditions that do not require assumption (4) from Section 23.2:
\[\text{rIIE} = \text{E}{\left[ \int_m \text{E}{\left[Y \mid A = 1, M = m, C\right]}\, dF_{M \mid A=0, C}(m) \right]} - \text{E}{\left[ \text{E}{\left[Y \mid A = 1, M, C\right]} \right]},\]
where \(C\) are baseline covariates sufficient to control confounding of both the \(A \to Y\) and \(M \to Y\) pathways. This expression can be estimated from observed data using outcome regression, IP weighting, or doubly robust methods.
In the structural causal model (SCM) framework of Pearl (2000), mediation is analyzed using the do-operator \(\text{do}(M = m)\), which represents an intervention that sets \(M\) to a fixed value \(m\) by removing all arrows into \(M\) in the causal DAG.
Definition 6 (Direct Effect via the Do-Operator) The controlled direct effect in Pearl’s framework is:
\[\text{CDE}(m) = \text{E}{\left[Y \mid \text{do}(A = 1), \text{do}(M = m)\right]} - \text{E}{\left[Y \mid \text{do}(A = 0), \text{do}(M = m)\right]}.\]
This is equivalent to the potential outcome expression \(\text{E}{\left[Y^{a=1,m}\right]} - \text{E}{\left[Y^{a=0,m}\right]}\) under the consistency assumption.
The natural direct and indirect effects in SCMs require an additional assumption — that the system obeys a composition rule — which corresponds to the cross-world consistency condition above. The interventionist approach avoids this by replacing \(\text{do}(M = M^{a=0})\) with \(\text{do}(M \sim F_{M^{a=0}})\), a stochastic do-intervention.
Fine Point 23.1: Mediation with Time-Varying Mediators
When the mediator \(M\) is itself time-varying — for example, when \(A\) is a baseline treatment and \(M_k\) is a biomarker measured at each follow-up visit — mediation analysis becomes a special case of the time-varying treatment framework from Chapters 19–21.
The sequence \(A \to M_0 \to M_1 \to \cdots \to M_K \to Y\), with treatment feeding back into subsequent mediator values, creates precisely the treatment-confounder feedback structure analyzed in Chapters 20 and 21. G-methods are therefore the appropriate tools for mediation analysis with time-varying mediators.
In this setting, the controlled direct effect is defined as the effect of \(A\) under an intervention that sets all \(M_k = 0\) (or to some reference value) for the entire follow-up period. The indirect effect is the difference between the total effect and this controlled direct effect.