How do I test for moderation and mediation in my model?

Many research models go beyond simple relationships between an independent variable (X) and a dependent variable (Y). You may want to know how or why X affects Y, which is a question of mediation. Or you may want to know when or for whom the effect of X on Y is stronger or weaker, which is a question of moderation.

Testing these effects correctly requires specific statistical approaches. Older methods that were once standard are now considered limited, and examiners increasingly expect modern techniques such as bootstrapped indirect effects and probing of interactions. This post explains how to test moderation and mediation step by step, which tools to use, how to interpret the results and how to report them.

A quick reminder: moderation vs. mediation

  • Mediation: X affects a mediator (M), which in turn affects Y. The mediator explains the mechanism. Path: X → M → Y.
  • Moderation: a moderator (W) changes the strength or direction of the relationship between X and Y. The effect of X on Y depends on the level of W.

Example: Leadership support (X) may increase employee engagement (Y) through psychological safety (M), which is mediation. The effect of leadership support on engagement may be stronger for new employees than for experienced ones, which is moderation by tenure (W).

Part 1: Testing mediation

The classic approach: Baron and Kenny (1986)

Baron and Kenny's causal steps approach was the dominant method for many years. It requires:

  1. X significantly predicts Y (path c).
  2. X significantly predicts M (path a).
  3. M significantly predicts Y while controlling for X (path b).
  4. The effect of X on Y is reduced (partial mediation) or becomes non-significant (full mediation) when M is included (path c').

This approach is still widely cited, but methodologists, including Andrew Hayes and others, have identified limitations. In particular, a significant total effect of X on Y is no longer considered necessary for mediation, the approach does not directly test the indirect effect, and it has relatively low power. The Sobel test was often added to test the indirect effect, but it assumes the indirect effect is normally distributed, which is often not the case.

The modern approach: testing the indirect effect directly

The current recommended approach focuses on the indirect effect, calculated as the product of path a and path b (a × b). Because the sampling distribution of this product is usually not normal, researchers use bootstrapping to create confidence intervals.

Bootstrapping works by repeatedly resampling your data with replacement (commonly 5,000 or more times), calculating the indirect effect in each resample, and using the distribution of these estimates to form a confidence interval. If the 95% bootstrap confidence interval for the indirect effect does not include zero, the indirect effect is considered statistically significant.

Tools for mediation analysis

  • PROCESS macro for SPSS, SAS and R, developed by Andrew Hayes. Model 4 tests simple mediation. It is widely used in social sciences and provides bootstrapped confidence intervals automatically.
  • Structural equation modelling (SEM) software, such as AMOS, Mplus or lavaan in R, which can test mediation with latent variables and bootstrapping.
  • Jamovi and JASP modules for mediation analysis.

Steps for simple mediation using PROCESS (Model 4)

  1. Install the PROCESS macro in SPSS.
  2. Specify Y (outcome), X (predictor) and M (mediator).
  3. Choose Model 4.
  4. Set the number of bootstrap samples (for example, 5,000) and request confidence intervals.
  5. Add covariates if needed.
  6. Run the analysis and examine: path a (X → M), path b (M → Y controlling for X), the direct effect c' (X → Y controlling for M), the total effect c, and the indirect effect a × b with its bootstrap confidence interval.

Interpreting mediation results

  • If the indirect effect CI excludes zero, there is evidence of mediation.
  • If the direct effect c' is also significant, some researchers describe this as “partial mediation”; if not, “full mediation”. Many methodologists now recommend avoiding these labels and instead reporting and interpreting the size of both direct and indirect effects.
  • Consider reporting a standardised or completely standardised indirect effect to aid interpretation.

Multiple and serial mediation

Models can include several mediators in parallel (such as PROCESS Model 4 with multiple M variables) or in sequence (serial mediation, PROCESS Model 6). These allow you to compare specific indirect effects.

Part 2: Testing moderation

The basic idea

Moderation is tested using an interaction term: the product of X and W. In regression:

Y = b₀ + b₁X + b₂W + b₃(X × W) + error

If the coefficient for the interaction term (b₃) is statistically significant, the effect of X on Y depends on W. This is evidence of moderation.

Steps for testing moderation

  1. Prepare variables. Many researchers mean-centre continuous X and W (subtract the mean from each score) before creating the interaction term. Centring does not change the interaction coefficient itself, but it makes the lower-order coefficients easier to interpret. Categorical moderators should be coded appropriately, such as 0 and 1 for two groups.
  2. Create the interaction term (X × W), or let PROCESS (Model 1) or other software create it automatically.
  3. Run the regression, often hierarchically: enter X and W in step 1, then the interaction in step 2. The change in R² (ΔR²) shows the additional variance explained by the interaction.
  4. Check significance of the interaction term.

Probing the interaction

A significant interaction tells you that moderation exists, but not what it looks like. You must probe it:

  • Simple slopes analysis: tests the effect of X on Y at specific values of W, commonly the mean and one standard deviation above and below the mean (or at the 16th, 50th and 84th percentiles, a default option in PROCESS). For categorical moderators, test the effect in each group.
  • Johnson–Neyman technique: identifies the range of W values where the effect of X on Y is statistically significant. PROCESS can provide this.
  • Plot the interaction: draw regression lines for Y on X at different levels of W. This visual is often the clearest way to communicate moderation.

Interpreting moderation

For example: “The positive relationship between workload and burnout was stronger for employees with low supervisor support (b = 0.62, p < .001) than for those with high supervisor support (b = 0.21, p = .04).” (Illustrative values.) This shows that support buffers the effect of workload on burnout.

Part 3: Combining moderation and mediation

Some models include both. For example, the indirect effect of X on Y through M may be stronger at some levels of W. This is called moderated mediation or a conditional process model. PROCESS offers many pre-specified models for this, such as Model 7 (moderator on the X → M path) and Model 14 (moderator on the M → Y path). The key statistic is the index of moderated mediation and its bootstrap confidence interval, together with conditional indirect effects at different values of the moderator.

Important assumptions and cautions

  • Causal language: mediation implies a causal sequence. With cross-sectional data, you can test whether data are consistent with a mediation model, but you cannot establish causal order. Acknowledge this limitation.
  • Theory first: specify mediators and moderators based on theory, not by testing every variable available.
  • Measurement quality: measurement error reduces power and can bias estimates, especially for interaction terms. Reliable measures are important. SEM with latent variables can help.
  • Sample size: interaction effects are often small and need larger samples to detect.
  • Regression assumptions: check linearity, homoscedasticity, normality of residuals and multicollinearity.

A pre-analysis checklist

Before running any mediation or moderation analysis, check that you can answer yes to the following:

  • My hypotheses clearly state which variables are mediators and which are moderators, and why.
  • Each path in my model is supported by theory or previous research.
  • I have drawn a conceptual diagram of the model and, if using PROCESS, identified the matching model number.
  • My measures for X, M, W and Y are reliable in my sample.
  • I have screened the data for missing values, outliers and coding errors.
  • I have decided in advance which covariates to include, and why.
  • My sample size is adequate for the effects I expect, especially for interaction terms.
  • I know how I will probe and present any significant interaction.
  • I have planned how to discuss the limits of causal inference in my design.

Working through this list before analysis prevents many of the problems that examiners commonly raise, such as unclear model logic, arbitrary covariates, or interactions that are reported but never explained.

How to report results

Mediation example

“Leadership support was positively associated with psychological safety (a = 0.48, p < .001), and psychological safety was positively associated with engagement controlling for leadership support (b = 0.35, p < .001). The indirect effect was significant, ab = 0.17, 95% bootstrap CI [0.10, 0.25], based on 5,000 bootstrap samples. The direct effect remained significant (c' = 0.22, p = .002).” (Illustrative values.)

Moderation example

“The interaction between workload and supervisor support was significant, b = −0.21, p = .003, ΔR² = .03. Simple slopes analysis showed that workload was more strongly associated with burnout at low support (−1 SD) than at high support (+1 SD). Figure 4.2 illustrates this interaction.” (Illustrative values.)

Common mistakes to avoid

  • Relying only on Baron and Kenny's steps or the Sobel test.
  • Requiring a significant total effect before testing mediation.
  • Reporting a significant interaction without probing or plotting it.
  • Confusing moderators and mediators.
  • Using causal language for mediation with cross-sectional data without discussion.
  • Testing many possible moderators without theoretical justification.

Final thoughts

Testing mediation means testing the indirect effect, ideally with bootstrap confidence intervals. Testing moderation means testing an interaction term, then probing and plotting it to show how the effect changes. Tools such as PROCESS and SEM software make both analyses accessible, but good theory, reliable measures and careful interpretation remain essential. Report your models clearly, use diagrams, and be honest about what your design can and cannot show.

Are you testing mediation or moderation in your thesis? Share your model in the comments.