Section 3.6

Mediation & Indirect Effects

Regression tells you that X affects Y. Mediation asks the deeper question: how? It proposes a mechanism: a mediator M that sits in the causal chain between them. Stress (X) worsens health (Y)… but through poor sleep (M). Mediation analysis is how you test that story with numbers.

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 how much of X's influence flows through the mediator. Shrink the direct path c′ toward zero for full mediation.

Indirect effect (a×b)
Direct effect (c′)
Total effect
Mediation

Full vs. partial mediation

  • Full mediation: the direct path c′ is essentially zero. X affects Y only through M; the mechanism explains the whole story.
  • Partial mediation: c′ is still meaningful. M carries some of the effect, but X also reaches Y by other routes.

The interesting quantity is usually the proportion mediated, the indirect effect as a share of the total. A large share means you've found a real mechanism, not just a correlation.

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, and it is worth knowing why, because plenty of textbooks still teach it as a gate.

An indirect effect can be real and cleanly estimated while the total effect of X on Y sits nowhere near significance. Sometimes the study simply has less power for the total effect than for the two paths that compose it. Sometimes a direct path of the opposite sign cancels part of what travels through M, so the two routes hide each other in the sum. Modern practice puts the interval on a×b directly and treats a null total effect as one more thing to explain, not as permission denied.

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 are the tool for making that theory explicit, and they expose an assumption the three-regression recipe never mentions: even when you randomly assign X, nothing randomizes M. Any unmeasured common cause of the mediator and the outcome biases path b, and therefore biases the indirect effect, in a study that looks like a clean experiment.

Why it matters: "why" and "how" questions are the heart of science. Mediation is the main statistical tool for testing mechanisms — turning "X is associated with Y" into "X works 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?

Many more than the study you were probably picturing. 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. Simulating 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 the product costs you more than either of its halves. The practical consequence is that mediation added to an existing study as a bonus analysis is usually underpowered, and a null indirect effect from 60 participants tells you very little.

Can mediation analysis prove causation?

It quantifies a pattern consistent with your proposed causal chain, nothing stronger: the statistics can't verify the arrows' directions, and reversed or confounded models often fit equally well. The causal weight rests on design (temporal ordering, experiments, longitudinal data) and theory. Cross-sectional mediation, where X, M, and Y are measured simultaneously, deserves particular skepticism.