Written and maintained by CASRAI Editorial Board
Last updated
Causal mediation analysis is the potential-outcomes formalization of the mediation question: instead of testing an indirect-effect coefficient in a regression, it defines the natural direct and indirect effects as counterfactual contrasts, states exactly what assumption is required to identify them from data, and gives that assumption a name — sequential ignorability. This page covers that formal layer specifically. For the applied procedure most researchers actually run — bootstrapped indirect effects, Hayes’ PROCESS macro, sample-size planning, and how to write up the results — see mediation analysis: methods and reporting, which this page assumes as background and does not repeat. If you’re still deciding whether your third variable is a mediator or a moderator in the first place, start with mediator vs. moderator instead.
Two different things called “mediation analysis”
The regression tradition — causal steps, the Sobel test, bootstrapped ab — tests whether an indirect-effect coefficient is distinguishable from zero. It’s a statistical procedure with an implicit causal interpretation bolted on afterward. The causal-inference tradition, formalized by Kosuke Imai, Luke Keele, and Dustin Tingley starting with their 2010 paper in Psychological Methods, works in the opposite order: it first defines the causal quantities of interest — the natural direct effect and natural indirect effect — in terms of potential outcomes, then asks what has to be true of the data-generating process for those quantities to be recoverable (identified) from an observed sample, then only afterward supplies an estimator. The regression-coefficient approach and the potential-outcomes approach often land on similar numbers in the simplest case (a linear model, no treatment–mediator interaction) — but they are not the same object, and treating “the bootstrap CI excluded zero” as equivalent to “the causal effect is identified and estimated correctly” skips the assumption this page exists to make explicit.
Potential outcomes and the two counterfactual quantities
Let X be a binary treatment (0/1), M the mediator, and Y the outcome. In potential-outcomes notation, Mi(x) is the value unit i‘s mediator would take under treatment level x, and Yi(x, m) is the value unit i‘s outcome would take under treatment level x and mediator level m. Only one combination is ever observed for any real unit — everything else is counterfactual, exactly as in any potential-outcomes treatment-effect framework.
The device that makes mediation specifically hard, and that gives the framework its name, is a cross-world quantity: Yi(1, Mi(0)) — the outcome unit i would have under treatment, but with the mediator value it would have taken without treatment. No real unit can ever be simultaneously treated and untreated, so this quantity is never observed even in principle, not merely unmeasured in a particular sample. With it, the two natural effects are defined as:
- Natural indirect effect, NIE(t) = E[Yi(t, Mi(1)) − Yi(t, Mi(0))] — holding treatment fixed at level t, how much would the outcome change if the mediator moved from the value it takes under control to the value it takes under treatment. This is the effect that operates through M.
- Natural direct effect, NDE(t) = E[Yi(1, Mi(t)) − Yi(0, Mi(t))] — holding the mediator fixed at whatever value it would take under treatment level t, how much would the outcome change from switching treatment. This is everything X does to Y that doesn’t route through M.
Because each is indexed by which treatment level the other variable is held at, there are, in general, two versions of each — NIE(1) and NIE(0), NDE(1) and NDE(0) — and they need not be equal. They coincide only under a “no-interaction” restriction (X and M don’t interact in how they jointly determine Y). The total effect decomposes exactly as TE = NDE(0) + NIE(1) = NDE(1) + NIE(0), which is the potential-outcomes version of the direct-plus-indirect-equals-total identity, but stated without assuming linearity anywhere. This is the substantive difference from the product-of-coefficients estimand: ab is a single number computed from two regression slopes; NDE and NIE are defined independently of any particular model, and a linear model with no interaction is simply the special case where the regression coefficients happen to equal them.
Sequential ignorability: the assumption that makes NDE/NIE identifiable
Natural effects are defined for every unit regardless of the data; whether they can be estimated from an observed sample is a separate question, and it’s the one Imai, Keele, and Tingley’s identification result answers. Sequential ignorability has two parts, and both matter:
- No unmeasured confounding of the treatment–outcome and treatment–mediator relationships, given pre-treatment covariates. Random assignment of X satisfies this part directly — it’s the same requirement as for a simple average treatment effect.
- No unmeasured confounding of the mediator–outcome relationship, given treatment and pre-treatment covariates — and, in the stronger version the identification result actually requires, this has to hold even for the cross-world potential outcome Yi(t, m) evaluated at treatment levels other than the one that produced that value of m. This second part is not delivered by randomizing X, and it is the part that does the real work in this framework. Participants are randomized to a level of X; nothing randomizes them to a level of M. Whatever else causes a person to land at a given level of the mediator — beyond what treatment assigned them — and that also affects Y independently, is a live confound of the M→Y path unless it is measured and adjusted for, or M itself was experimentally manipulated (a separate design, sometimes called a parallel-encouragement or mediator-randomization design, that most single-experiment mediation studies don’t use).
This is not a special mediation-specific pathology; it’s the same omitted-variable problem documented in general terms at endogeneity: the three sources, and the remedy that matches each — mediation is simply one specific place a version of that problem always shows up, because the mediator is, by construction, a post-treatment variable and therefore a candidate for its own confounding. Sequential ignorability is not testable from the data at hand — no observed-data check can rule out an unmeasured M–Y confounder, which is why the framework’s second contribution (below) is a way to state, rather than eliminate, that uncertainty.
Nonparametric identification: what Imai, Keele, and Tingley actually proved
Under sequential ignorability, Imai, Keele, and Tingley showed NDE and NIE are nonparametrically identified: they can be written as an integral (the “mediation formula”) over the conditional distribution of M given X and covariates, without assuming a linear functional form for either the mediator or outcome model and without assuming X and M don’t interact. This is the concrete technical advance over the regression tradition, which gets identification “for free” only in the linear, no-interaction special case and has no general answer for a binary, count, or otherwise nonlinear mediator or outcome model. A companion paper, Imai, Keele, and Yamamoto’s 2010 piece in Statistical Science, works out the estimation and sensitivity-analysis machinery for applying the identification result in practice, and both results are implemented together in the R mediation package (Tingley, Yamamoto, Hirose, Keele, and Imai), documented in Tingley et al.’s 2014 Journal of Statistical Software paper. In that package, mediate() estimates the average causal mediation effect (ACME, the package’s name for the natural indirect effect) and the average direct effect (ADE) via a quasi-Bayesian Monte Carlo approximation to the mediation formula — simulating from the fitted mediator and outcome models rather than requiring closed-form integration — which is what lets it handle nonlinear component models (logistic, count, survival) the same way it handles linear ones.
Where this actually diverges from product-of-coefficients: a worked simulation
To make the divergence concrete rather than assert it, the table below comes from a seeded simulation with a known data-generating process — not a real dataset, and not a general result, but every number in it is computed directly from the stated model, reproducible from the parameters given. N = 500,000, treatment X ~ Bernoulli(0.15) (an imbalanced split, deliberately, for reasons explained below), mediator M(x) = 0.5x + εM, outcome Y(x,m) = 0.2x + 0.4m + 0.3·x·m + εY, with εM, εY independent standard normal draws. The 0.3·x·m term is a genuine treatment–mediator interaction: the mediator matters more for the outcome under treatment than under control.
| Quantity | Value | How it’s computed |
|---|---|---|
| True NIE(1) — indirect effect among the treated | 0.350 | Exact: averaged directly from each unit’s own simulated potential outcomes, Yi(1,Mi(1)) − Yi(1,Mi(0)) |
| True NIE(0) — indirect effect among the untreated | 0.200 | Same construction at treatment level 0 |
| Equal-weighted average natural indirect effect | 0.275 | (NIE(1) + NIE(0)) / 2 |
| Naive product-of-coefficients ab, interaction omitted | 0.224 | OLS of M on X (â), OLS of Y on X and M with no X·M term (b̂), multiplied |
The naive estimate (0.224) understates the true effect among the treated, NIE(1) = 0.350, by 36%, and even understates the simple average of the two treatment-specific effects (0.275) by about 19% — not because of sampling noise (N is large and the simulation is deterministic given its seed), but because a regression that omits the interaction term is fitting a single pooled slope to a relationship that genuinely differs by treatment group, and an imbalanced design (15% treated) weights that pooled slope away from the treated group’s steeper slope. A product-of-coefficients or bootstrapped-ab analysis that never tests for or models the interaction has no way to surface this — it returns one number and gives no indication that the “true” indirect effect actually depends on which treatment level you’re asking about. The causal-mediation framework’s NIE(1)/NIE(0) notation makes that dependence visible instead of averaging over it silently. (Reproduction: the simulation script, DGP parameters, and both the balanced and imbalanced variants are archived; the method is a direct Monte Carlo evaluation of the potential-outcomes definitions above, not a statistical estimator being tested against ground truth — the “true” values are exact given the stated model, not estimates.)
Sensitivity analysis: living with an untestable assumption
Because sequential ignorability’s second part cannot be verified from the data, the practical response the framework offers is not a workaround that removes the assumption — there isn’t one — but a way to quantify how much an estimated NDE or NIE would have to be wrong before an unmeasured confounder of a plausible size could explain it away. The mediation package’s medsens() implements this for the linear/probit case: it re-expresses the sensitivity as a single parameter, conventionally denoted ρ, representing the correlation between the error terms of the mediator equation and the outcome equation that an unmeasured confounder would need to induce. Sequential ignorability corresponds to ρ = 0; the sensitivity analysis reports the estimated ACME/NIE as a function of ρ and identifies the value of ρ at which the confidence interval for the indirect effect would cross zero. A result that only breaks down at an implausibly large ρ is more credible than one that breaks down at ρ = 0.05 — the analysis doesn’t prove the assumption holds, but it tells a reader how much it would take to be wrong, which is a materially more honest statement than reporting the point estimate alone.
Common mistakes specific to the causal-mediation framing
- Citing Imai/Keele/Tingley or “the causal mediation framework” while still fitting a plain linear model with no interaction term and reporting only one ab-style number. That’s the regression special case, not an application of the identification result — if there’s no reason to suspect a treatment–mediator interaction and the models are linear, the numbers may coincide, but the citation should match the method actually used.
- Treating “sequential ignorability” and “no unmeasured confounding” as interchangeable with the assumption behind a simple treatment-effect estimate. The first part (X→Y, X→M) is exactly that. The second part (M→Y given X) is a materially stronger requirement that randomization of X does not satisfy on its own — conflating the two is the single most common misstatement of this assumption in applied write-ups.
- Reporting a sensitivity analysis result as “the assumption is confirmed” or “mediation is robust” without stating the ρ threshold. The output is a curve or a breakdown point, not a pass/fail test; the number that makes the result interpretable is exactly the ρ at which the conclusion would flip.
- Assuming the natural indirect effect is a single, well-defined quantity when there’s reason to expect X×M interaction. Report NIE(1) and NIE(0) (or state explicitly which one, and why) rather than a single pooled number that silently averages over a real difference, as the worked simulation above illustrates.
Frequently asked questions
Is this just a more complicated way of running the same mediation analysis?
No — it’s a different starting point, not a more elaborate version of the same test. The regression tradition tests a coefficient and interprets it causally afterward; the causal-mediation framework defines the causal quantity first (as a potential-outcomes contrast), states the assumption required to recover it from data, and only then estimates it. In the simplest linear, no-interaction case the numbers can coincide, which is part of why the distinction is easy to miss in practice.
Does random assignment of the treatment make my mediation analysis causal?
It satisfies only the first half of sequential ignorability — no confounding of the X→M and X→Y relationships. It does not touch the second half, because no experiment randomizes participants to a level of the mediator itself; whatever besides treatment determines where a person lands on M can still confound the M→Y relationship. This is true even in a well-run randomized experiment, not just observational data.
When do NDE/NIE and the regression product-of-coefficients actually give the same number?
When the mediator and outcome models are both linear and there is no treatment–mediator interaction. That special case is exactly the setting the older regression tradition was built for; the potential-outcomes framework is what generalizes past it to nonlinear models and interactions, as the worked simulation above shows concretely.
What does it mean for sequential ignorability to be “untestable”?
It requires no unmeasured confounder of the M→Y relationship, including for cross-world counterfactual mediator values that are never actually observed for any unit — there is no diagnostic computable from the observed sample that can confirm or rule this out. Sensitivity analysis quantifies the consequence of that gap instead of closing it.
Do I need special software, or does my existing PROCESS/SEM workflow already do this?
PROCESS and a standard bootstrapped path model estimate the regression-based indirect effect, which is not the same estimand unless the no-interaction, linear special case applies. The R mediation package (Tingley, Yamamoto, Hirose, Keele, and Imai) is the standard implementation of the identification and sensitivity-analysis results described here; Stata’s mediation or paramed commands implement closely related regression-based decompositions (the Valeri–VanderWeele approach) that recover NDE/NIE under somewhat different, more explicit parametric assumptions.
See also: mediation analysis: methods and reporting for the applied bootstrap procedure this page’s framework sits underneath; mediator vs. moderator for the prior question of which one your hypothesis needs; endogeneity: the three sources, and the remedy that matches each for the general confounding problem sequential ignorability is one instance of; path analysis and structural equation modeling for the multi-path regression setting; and natural experiments and regression discontinuity design for other identification strategies against unmeasured confounding.








