Mediation & Indirect Effects
Regression tells you that X affects Y. Mediation asks the deeper question: how? It proposes a mechanism: a mediator M that comes between X and Y in the causal chain. Stress (X) worsens health (Y)… but through poor sleep (M). Mediation analysis tests that explanation with data.
Three paths, one diagram
Mediation breaks the X → Y relationship into a chain of regression paths:
- Path a: the effect of X on the mediator M.
- Path b: the effect of M on Y, controlling for X.
- Path c′ (the direct effect): whatever effect of X on Y remains after accounting for M.
The indirect effect, the part of X's influence that travels through M, is simply a × b. And the total effect of X on Y is the indirect plus the direct: a×b + c′.
🎮 Path Diagram Explorer
Adjust the three paths. The indirect effect (a×b) is the part of X's influence that passes through the mediator. Shrink the direct path c′ toward zero for full mediation.
Full vs. partial mediation
- Full mediation: the direct path c′ is essentially zero. X affects Y only through M.
- Partial mediation: c′ is still meaningful. M accounts for part of the effect, but X also affects Y by other routes.
The quantity usually reported is the proportion mediated, the indirect effect as a share of the total. A large share says that most of the effect runs through M, if the causal model is right.
Test the indirect effect directly. Rather than checking each path for "significance" on its own, the modern approach puts a confidence interval on the product a×b, usually with bootstrapping (resampling the data thousands of times). The old Sobel test assumes a×b is normally distributed, which it often isn't, so bootstrapped intervals are preferred.
The step that got retired
For two decades the standard recipe was Baron and Kenny's causal steps: first show that X predicts Y, then that X predicts M, then that M predicts Y controlling for X, and only then discuss mediation. That first step has since been dropped, although many textbooks still teach it as a requirement.
An indirect effect can be real and precisely estimated while the total effect of X on Y is nowhere near significant. Sometimes the study simply has less power for the total effect than for the two paths that make up the indirect one. Sometimes the direct path has the opposite sign to the indirect one, so the two partly cancel in the total. Modern practice puts the interval on a×b directly and treats a null total effect as something to explain, not as a reason to stop the analysis.
A serious caution
Mediation makes a strong causal claim: that X causes M causes Y, in that order. The statistics can't verify the ordering; they only quantify a pattern that's consistent with your proposed mechanism. Reverse the arrows and the math often still "works." So mediation is only as trustworthy as the theory and study design behind it. Cross-sectional mediation, in particular, is easy to over-interpret.
Causal DAGs make that theory explicit, and they show an assumption that the three-regression recipe leaves out. Even when you randomly assign X, M is not randomized. Any unmeasured common cause of the mediator and the outcome biases path b, and therefore the indirect effect, even in a study that looks like a clean experiment.
Why it matters: many research questions ask how an effect works, not only whether it exists. Mediation is the main statistical tool for testing a proposed mechanism, the claim that X affects Y by way of M.
Common questions
What is the difference between a mediator and a moderator?
A mediator is a mechanism: X causes M, which causes Y — stress harms sleep, which harms health (an arrow chain, tested with indirect effects). A moderator changes the strength of an effect: the training works for novices but not experts (an "it depends," tested with interaction terms). Mediation answers "how does it work?"; moderation answers "for whom / when?"
How many participants does a mediation analysis need?
Usually more than people expect. Because the indirect effect is a product, both paths have to be estimated well, so the sample is set by the weaker of the two. In simulations of the percentile bootstrap on standardized data, two medium paths (a = b = .39) reach 80% power at about 70 to 80 people, while two small paths (a = b = .14) need roughly 550. For comparison, detecting a single correlation of .14 on its own takes about 400, so testing the product needs more people than testing either path alone. A mediation analysis added to an existing study as an extra is therefore usually underpowered, and a null indirect effect from 60 participants tells you very little.
Can mediation analysis prove causation?
It only quantifies a pattern consistent with your proposed causal chain. The statistics can't verify the direction of the arrows, and reversed or confounded models often fit equally well. Any causal conclusion has to come from the design (temporal ordering, experiments, longitudinal data) and from theory. Cross-sectional mediation, where X, M, and Y are measured simultaneously, deserves particular skepticism.