Simple Mediation (X→M→Y)
VerifiedMediation (legacy hub)
Run this test straight away on a free built-in teaching dataset — no data of your own needed — or bring your own. Either opens the guided workspace: variable setup, assumption diagnostics, results with effect sizes and confidence intervals, figures, and APA-ready reporting.
Loading teaching datasets…
Or use your own dataset
Loading your datasets…
Tests whether an independent variable affects an outcome THROUGH a mediator (X → M → Y).
Simple mediation estimates the indirect effect (a × b) of X on Y via one mediator with a bootstrap confidence interval; a significant indirect effect means the mediator carries part of X's influence.
Worked example
Does exercise improve mood by improving sleep?
Exercise (X) → sleep quality (M) → mood (Y) was tested with bootstrapped mediation (5,000 samples, n = 200).
The indirect effect was significant (ab = 0.15, 95% CI [0.06, 0.25]); sleep partially mediated the exercise→mood link.
Sleep significantly mediated the effect of exercise on mood, indirect effect = 0.15, 95% CI [0.06, 0.25].
Try it yourself: Load this ready-made sample and follow the run above.
When to use it
- One mediator, a clear causal orderYou can defend that X precedes M precedes Y in time or logic. e.g. exercise (X) → sleep quality (M) → mood (Y).
- You want to know the mechanism, not just the effectA total X→Y effect is already plausible; the question is how much of it runs through M.
- Continuous mediator and outcomeM and Y are both interval-scaled, so ordinary regressions estimate the a and b paths.
When NOT to — use instead
- The outcome is yes/noA binary Y needs logistic paths and an odds/probability-scale indirect effect. → Binary-outcome mediation
- Two or more mediatorsModel them together so each specific indirect effect is adjusted for the others. → Parallel mediation
- The mediators form a chainIf M1 feeds M2, the sequence is the whole point. → Serial mediation
- The effect depends on a moderatorIf the indirect effect is expected to differ across groups or levels. → Moderated mediation
Hypotheses
Parameter tested: a·b — the product of the X→M path (a) and the M→Y path (b), estimated with a percentile bootstrap (default 5,000 resamples)
Assumptions (and what to do if they fail)
Check: Justify from design or theory that X precedes M and M precedes Y — the data alone cannot tell you the direction.
If violated: The indirect effect is uninterpretable; a reversed M and Y can fit equally well. Only a temporal or experimental design settles it.
Check: Ask whether a common cause could drive both the mediator and the outcome. Randomising X does not protect the M–Y link.
If violated: The b path — and so a·b — is biased. Measure and adjust for plausible M–Y confounders, or treat the estimate as associational.
Check: Inspect residuals of the M and Y regressions for curvature.
If violated: A curved relationship distorts a or b. Transform the variable, or move to a model that allows X×M interaction.
Check: Use ≥ 5,000 bootstrap resamples (the default).
If violated: Too few resamples make the CI endpoints jump between runs; the decision to reject can flip on noise.
Ready to run a Simple Mediation (X→M→Y) on your own data?
Guided setup, automatic assumption checks, effect sizes, figures and an APA write-up.
Run this test →