StatFas emblem: a philosopher beside a rising bar chart StatFas.comAn Easy Way to Do Statistics
Upload Data, and Get Publishable Results in a Few Seconds in APA7 format Docx file

Mediation Analysis: How to Run It Online and Report It in APA7

Mediation asks whether the effect of a predictor (X) on an outcome (Y) works through an intermediate variable, the mediator (M): X → M → Y.

What is Mediation Analysis?

Mediation asks whether the effect of a predictor (X) on an outcome (Y) works through an intermediate variable, the mediator (M): X → M → Y.

When to use it

Use it when theory says X influences M and M in turn influences Y, for example social support raising self-efficacy, which raises wellbeing. It estimates the indirect effect (through M) and the direct effect (not through M).

Example question: Does self-efficacy carry the effect of social support on wellbeing?

Preparing your data

One row per participant with three numeric columns: the predictor X, the mediator M and the outcome Y. Covariates are additional numeric columns.

Example dataset (simulated; first rows of 150): id, social_support (X), self_efficacy (M), wellbeing (Y).

idsocial_supportself_efficacywellbeing
1.04.54.54.4
2.04.63.962.9
3.05.14.52.4
4.04.055.234.03
5.04.743.12.74
6.04.084.354.69

Download the full example CSV to practise. If the tool asks for a different layout, follow the instructions on its page.

How to run it on StatFas

  1. Open the Mediation Analysis tool. You do not need an account to run an analysis.
  2. Enter your data or upload your file, laid out as described in Preparing your data.
  3. Select your variables. Select X, M and Y (and optional covariates). Use a bootstrap confidence interval for the indirect effect when the tool offers it.
  4. Choose any options the tool offers (for example the confidence level, a post hoc test or the error bar type) and run the analysis.
  5. Read the results on the page. Check the assumptions first, then the test statistic, the p-value and the effect size.
  6. To save your results, log in or create a free account. Every analysis stays free; the account is only needed to download.

Assumptions and checks

  • A causal ordering X → M → Y justified by theory or design. Cross-sectional data can show consistency with mediation but cannot prove it.
  • The regression assumptions hold for the two regressions (linearity, independent errors, similar residual spread).
  • Test the indirect effect with a bootstrap confidence interval, because the product of two coefficients is not normally distributed.
  • Adequate sample size; indirect effects are small and need power (often 100–200 cases or more).
  • No unmeasured confounding of the M–Y relationship, which is difficult to rule out outside experiments.

Key numbers to look at

  • Path a: X → M.
  • Path b: M → Y controlling for X.
  • Indirect effect (ab) with a bootstrap 95% CI: mediation is supported if the interval excludes zero.
  • Direct effect (c′) and total effect (c).

Effect size

Report the unstandardised or standardised indirect effect with its confidence interval. Some papers add the proportion mediated (ab/c), which is unstable when the total effect is small.

Benchmarks such as small, medium and large are conventions (Cohen, 1988), not rules. Interpret size in the context of your field.

Reporting Mediation Analysis in APA7 style

Template

Social support significantly predicted self-efficacy (a = X.XX, p < .001), which in turn predicted wellbeing controlling for support (b = X.XX, p < .001). The indirect effect was statistically significant (ab = X.XX, 95% bootstrap CI [X.XX, X.XX], 5,000 resamples). The direct effect was c′ = X.XX, p = .XXX.

Worked example (simulated data)

The numbers below were computed from the example CSV above, so you can reproduce them. They illustrate the format and are not real findings.

Social support significantly predicted self-efficacy (a = 0.53, p < .001), which in turn predicted wellbeing controlling for support (b = 0.62, p < .001). The indirect effect was statistically significant (ab = 0.33, 95% bootstrap CI [0.22, 0.45], 5,000 resamples). The direct effect was c′ = 0.11, p = .175, and the total effect was c = 0.45.

APA7 reminders: italicise statistical symbols (M, SD, t, F, p, r), report exact p-values to two or three decimals (use p < .001 for very small values), omit the leading zero for values that cannot exceed 1 (.45, not 0.45), and put degrees of freedom in parentheses. See the APA7 cheat sheet.

Common mistakes

  • Treating mediation as proven causal evidence in cross-sectional data.
  • Relying on the old causal-steps approach and the Sobel test instead of a bootstrap interval.
  • Calling the mediation "full" just because the direct effect is non-significant.
  • Moderation: If the effect changes depending on another variable.
  • SEM: For several mediators or latent variables.
  • Linear Regression: For a single regression step.

Not sure which analysis you need? Use the test chooser.

Frequently asked questions

What is the difference between mediation and moderation?

A mediator explains how or why X affects Y. A moderator changes the strength or direction of the effect of X on Y.

How many bootstrap samples should I use?

5,000 is a common choice and 10,000 is sometimes used for the final analysis.

References

American Psychological Association. (2020). Publication manual of the American Psychological Association (7th ed.). https://doi.org/10.1037/0000165-000

Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd ed.). Lawrence Erlbaum Associates.

Hayes, A. F. (2022). Introduction to mediation, moderation, and conditional process analysis: A regression-based approach (3rd ed.). Guilford Press.

This guide is for learning and for preparing results for your own reports. You remain responsible for choosing an appropriate analysis, checking its assumptions and interpreting the results. Follow the formatting rules of your journal or institution where they differ from APA7.