Unit 12 · Moderation and mediation
How to run a mediation analysis in SPSS with PROCESS
Test mediation with Hayes PROCESS Model 4 in SPSS: a and b paths, direct and indirect effects, bootstrap confidence intervals and APA reporting.
Quick answer: How do you run a mediation analysis in SPSS with PROCESS?
- Install the free PROCESS macro from processmacro.org.
- Click Analyze › Regression › PROCESS, then enter Y, X and the mediator M.
- Choose Model number 4 and 5000 bootstrap samples, then click OK.
- Read the indirect effect: it is significant if the bootstrap CI excludes zero.
Report it in APA style: Sleep quality mediated the effect of stress on wellbeing, indirect effect = −0.36, 95% CI [−0.53, −0.21].
What is mediation?
Mediation tests whether the effect of X on Y works through a third variable, the mediator (M). It answers how or why questions, such as whether stress lowers wellbeing partly because it disrupts sleep.
When to use it
- You have a theory about the mechanism linking X and Y.
- Ideally, X comes before M, and M before Y, in time.
How it works
Path a is the effect of X on M. Path b is the effect of M on Y, controlling for X. The indirect effect is a × b. The direct effect (c′) is what’s left of X → Y once M is in the model, and the total effect c = c′ + ab. Because the indirect effect isn’t normally distributed, PROCESS tests it with a bootstrap confidence interval (usually 5000 samples): if the CI doesn’t include zero, the indirect effect is significant. Older approaches (Baron and Kenny’s steps, the Sobel test) are no longer recommended.
Assumptions
- The same assumptions as regression for each path.
- A plausible causal order. Cross-sectional data can’t prove the order, so be cautious about causal claims.
Worked example
Sleep quality mediated the effect of stress on wellbeing, indirect effect = −0.36, 95% CI [−0.53, −0.21]. The direct effect remained significant (c′ = −0.38, p = .001), suggesting partial mediation.
Key terms
- Mediator
- The variable through which X affects Y.
- Indirect effect
- a × b: the part of X’s effect that goes through M.
- Direct effect (c′)
- X’s effect on Y with M controlled.
- Bootstrapping
- Resampling the data thousands of times to estimate a confidence interval.
Common mistakes
- Requiring a significant total effect before testing mediation (no longer required).
- Making strong causal claims from cross-sectional data.
- Reporting a p-value for the indirect effect instead of the bootstrap CI.
How to do it in SPSS
The SPSS syntax
Prefer typing to clicking? Open File › New › Syntax, paste this in, select it and choose Run › Selection. Every dialog's Paste button writes the same kind of code.
* Run process.sps (from processmacro.org) once per session first, then:
process y=wellbeing/x=stress/m=sleep/model=4/total=1/boot=5000.Practice data
Download the file used in this lesson and run it yourself in SPSS. Your results will closely match the screens above, though a few numbers may differ slightly.
- stress_sleep.savStress, sleep quality and wellbeing (N = 200)
Now practise it interactively →
Reading is only half of it. Tap through the real SPSS menus, read the output and pick the right write-up in 7 quick questions, with instant feedback on every answer.
Practice for this lesson is part of Pro, with every unit, unlimited hearts and saved progress.