Moderation and interaction effects
“Does the effect of X on Y depend on Z?” is one of the most interesting questions a study can ask. Does a therapy work better for younger patients? Does study time pay off more for some students? These are moderation questions, and they’re answered with interaction terms.
Moderation vs mediation
- Moderation: when or for whom does X affect Y? The moderator changes the size or direction of the X–Y relationship.
- Mediation: how or why does X affect Y? The mediator sits on the pathway between them (X → M → Y).
The interaction model
Y = b₀ + b₁X + b₂M + b₃(X × M)
b₃ tests moderation. If it’s zero, the slope of X is the same at every value of M. If it isn’t, the slope of X is b₁ + b₃M, so it changes with M.
A crucial consequence: with the interaction included, b₁ is the effect of X when M = 0 (or in the reference group), not an average effect. Reading it as “the effect of X” is the most common mistake in interpreting interactions.
Worked example: does weight affect fuel economy differently by transmission?
In R’s mtcars data, we predict miles per gallon from weight (1,000 lb), transmission type (automatic is the reference, manual = 1), and their interaction.
Reference category am: 0 Interaction terms: wt x am Model: Linear regression (OLS) Outcome: mpg N: 32 R-squared: 0.8330 Adjusted R-squared: 0.8151 F-statistic: 46.5674 F df: 3, 28 P-value: 5.209e-11 === COEFFICIENTS === const: coef=31.4161, se=3.0201, t=10.4023, p=0.0000, ci=[25.2296, 37.6025] wt: coef=-3.7859, se=0.7856, t=-4.8188, p=0.0000, ci=[-5.3952, -2.1766] am_1: coef=14.8784, se=4.2640, t=3.4893, p=0.0016, ci=[6.1439, 23.6129] wt:am_1: coef=-5.2984, se=1.4447, t=-3.6674, p=0.0010, ci=[-8.2577, -2.3390] === DIAGNOSTICS === VIF wt: 2.728 VIF am_1: 20.901 VIF wt:am_1: 15.367 Breusch-Pagan p (homoscedasticity): 0.6943 Residual normality p: 0.1466 Influential observations (Cook's D > 4/n): 3 Linearity RESET p: 0.2426
> summary(lm(mpg ~ wt * factor(am), data = mtcars))$coefficients
Estimate Std. Error t value Pr(>|t|)
(Intercept) 31.416055 3.0201093 10.402291 4.001043e-11
wt -3.785908 0.7856478 -4.818836 4.551182e-05
factor(am)1 14.878423 4.2640422 3.489277 1.621034e-03
wt:factor(am)1 -5.298360 1.4446993 -3.667449 1.017148e-03The coefficients match R exactly.
Interpreting the coefficients
- Interaction (weight × manual): b = −5.30, 95% CI [−8.26, −2.34], p = .001. The weight effect differs by transmission type, so there is evidence of moderation.
- Weight: b = −3.79. This is the slope for automatic cars (the reference group): each extra 1,000 lb goes with 3.79 fewer mpg.
- Slope for manual cars: −3.79 + (−5.30) = −9.08 mpg per 1,000 lb, more than twice as steep.
- Manual: b = 14.88. This is the predicted mpg difference between manual and automatic cars at a weight of zero, which is meaningless in itself. It doesn’t mean manuals get 15 more mpg.
In words: lighter manual cars are much more economical than lighter automatics, but the advantage shrinks, and eventually reverses, as cars get heavier.
About those large VIFs
The VIFs for the manual dummy (20.9) and the interaction (15.4) look alarming. That’s normal with interaction terms: X × M is naturally correlated with X and M. It doesn’t bias the interaction test. Centring continuous predictors (subtracting their mean) before forming the product reduces these VIFs and makes the main-effect coefficients interpretable at the average value instead of at zero, without changing the interaction coefficient or its p-value.
APA write-up
A regression with an interaction term showed that the association between weight and fuel economy depended on transmission type, b = −5.30, 95% CI [−8.26, −2.34], t(28) = −3.67, p = .001. Each additional 1,000 lb was associated with 3.79 fewer mpg for automatic cars and 9.08 fewer mpg for manual cars. The model explained 83% of the variance, R² = .83, F(3, 28) = 46.57, p < .001.
With 32 observational cars this is an association, not a causal effect of transmission, and manual and automatic cars differ in many other ways.
Probing interactions
- Categorical moderator: report the slope within each group, as above.
- Continuous moderator: report simple slopes at meaningful values of M, often the mean and ±1 SD. The Johnson-Neyman technique finds the range of M where X’s effect is significant.
- Always plot it: predicted Y against X, with separate lines for different levels of M.
In ANOVA terms, the same idea is a factor × factor interaction. See two-way ANOVA.
Common mistakes
- Interpreting main effects as average effects when an interaction is in the model.
- Leaving out the main effects and including only X × M. Keep both components in the model.
- Comparing p-values across subgroups (“significant for men, not for women”) instead of testing the interaction directly.
- Underpowered tests: interactions usually need much larger samples than main effects to detect.
How to run it
- SPSS: compute the product term (centre first), then add X, M and X × M in Linear Regression. Or use the PROCESS macro (model 1).
- R:
lm(y ~ x * m, data = df), then theinteractionsoremmeanspackages for simple slopes. - Analytika: ask, for example, “does the effect of weight on mpg depend on transmission?”. It adds the interaction term and reports it with the usual diagnostics.
More in Regression
Run this on your own data
Upload a dataset and ask your question in plain English. Analytika checks the assumptions, picks the test, runs it, and writes the results up in APA format.