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.

Free tutorialPro practiceAbout 5 minutes7 practice questions

Quick answer: How do you run a mediation analysis in SPSS with PROCESS?

  1. Install the free PROCESS macro from processmacro.org.
  2. Click Analyze › Regression › PROCESS, then enter Y, X and the mediator M.
  3. Choose Model number 4 and 5000 bootstrap samples, then click OK.
  4. 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].

Last updated November 2026 · Not sure this is the right test? Try the Which statistical test? tool.

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 mediation model

Mediation asks how or why an effect happens: does stress lower wellbeing partly because it disrupts sleep? PROCESS Model 4 tests this.

PROCESS Model 4 · Simple mediation
Stress (X)Sleep quality (M)Wellbeing (Y) a = −.45b = .80c′ = −.38 (total c = −.74)

a path1 · b path2 · c′ direct effect3 · indirect effect = a × b4

  1. 1
    a pathX → M: higher stress predicts poorer sleep quality (−.45).
  2. 2
    b pathM → Y, controlling for X: better sleep predicts higher wellbeing (.80).
  3. 3
    Direct effect c′The part of X → Y that doesn’t go through M.
  4. 4
    Indirect effecta × b = −.45 × .80 = −.36. This is what mediation tests.

In the PROCESS dialog: Y = wellbeing, X = stress, Mediator(s) M = sleep, Model number 4, 5000 bootstrap samples.

Reading mediation output

PROCESS prints one regression per outcome, then the effects. The indirect effect’s bootstrap confidence interval is the result.

Output1 [Document1] – SPSS Statistics Viewer
FileEditViewDataTransformAnalyzeGraphsUtilitiesExtensionsWindowHelp
Output
Log
PROCESS
Outcome: sleep
Outcome: wellbeing
Total effect
Indirect effect
OUTCOME VARIABLE: wellbeing
coeffsetpLLCIULCI
constant48.652.8417.13.00043.0554.25
stress−.381.11−3.45.001−.60−.16
sleep.80.145.71.000.521.08
Total effect of X on Y
EffectsetpLLCIULCI
−.742.11−6.73.000−.96−.52
Indirect effect(s) of X on Y
EffectBootSEBootLLCIBootULCI
sleep−.363.08−.53−.214

Percentile bootstrap CI based on 5000 bootstrap samples.

  1. 1
    Direct effectStress still predicts wellbeing with sleep in the model (p = .001), so this is partial mediation.
  2. 2
    Total effectc = −.74 = direct (−.38) + indirect (−.36).
  3. 3
    Indirect effect−.36: the part of the stress effect carried by sleep.
  4. 4
    Bootstrap CIFrom −.53 to −.21. It doesn’t include zero, so the indirect effect is significant. There’s no p-value for it.

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.

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.

More in Moderation and mediation