Mediation Analysis

Test whether a third variable explains the mechanism through which an independent variable affects an outcome.

Mediation Analysis tests whether the relationship between an independent variable (X) and an outcome (Y) operates through a mediating variable (M). The mediated (indirect) effect represents the portion of X's effect on Y that is transmitted through M. For example, does stress (X) affect health (Y) through sleep quality (M)? Mediation analysis decomposes the total effect into a direct effect (X → Y, bypassing M) and an indirect effect (X → M → Y).

Modern mediation analysis uses bootstrapping (Preacher & Hayes, 2008) to compute confidence intervals for the indirect effect, since its sampling distribution is non-normal. StatRyx uses 5,000 bootstrap samples to estimate the 95% bias-corrected bootstrap CI for the indirect effect — the gold standard approach. The classic Baron-Kenny causal steps are also reported for reference.

StatRyx tests simple mediation (single mediator) and reports the a path (X→M), b path (M→Y), c path (total, X→Y), c' path (direct, X→Y controlling M), the indirect effect (ab), and its bootstrapped 95% CI.

Mediation splits the total effect of X on Y (path c) into an indirect effect through the mediator (a × b) and a direct effect that remains (c′). The indirect effect is the test of mediation. Because its sampling distribution is not normal, it is tested with a bootstrap confidence interval: if the 95% CI excludes zero, the indirect effect is significant. The older Baron and Kenny steps and the Sobel test are no longer recommended.

When to use the Mediation Analysis

When not to use it

Worked example

PathBSEtp
a: Stress → Sleep (X→M)−0.410.09−4.56< .001
b: Sleep → Depression (M→Y)−0.440.11−4.00< .001
c': Stress → Depression (direct)0.240.092.67.012
Indirect (ab)0.18——CI [0.09, 0.31]

How to report it (APA 7)

A mediation analysis (bootstrapping, k = 5,000) tested whether sleep quality mediated the relationship between stress and depression. The indirect effect was significant, b = 0.18, 95% bootstrap CI [0.09, 0.31], indicating that stress influences depression partially through its effect on sleep quality. The direct effect was also significant, b = 0.24, p = .012.

Frequently asked questions

Is mediation analysis free on StatRyx?

Yes. You can run it without an account (3 free analyses), and a free account adds 10 more — a one-time allowance, no payment needed. Every result includes the APA 7 write-up. Paid plans (Student from $9/month) add more analyses and Word, PDF and Excel export.

What is the difference between full and partial mediation?

Full mediation: the direct effect (c') becomes non-significant after adding M — X only affects Y through M. Partial mediation: both c' and the indirect effect remain significant — M explains part but not all of X's effect on Y.

How many mediators can I have?

StatRyx currently supports single and parallel mediator models. For sequential (chain) mediation or complex structural models, describe your model in detail.

How do I report a mediation analysis in APA 7?

Report paths a, b, c and c′ with their coefficients, then the indirect effect with its bootstrap CI: "The indirect effect of stress on depression through sleep quality was significant, ab = 0.18, 95% BCa CI [0.09, 0.29], based on 5,000 bootstrap samples." A path diagram helps.

Do I need a significant total effect to test mediation?

No. Current guidance (Hayes; Zhao et al., 2010) tests the indirect effect directly. A significant indirect effect can exist even when the total effect is not significant, for example when the direct and indirect effects have opposite signs.

Run a Mediation Analysis on your data →

Related analyses