flowchart LR
X((X)) --> Y((Y))
W((W)) --> Y
XW((X times W)) --> Y
X -. "moderated by W" .- W
18 Moderation Analysis
18.1 Moderation in Context
Chapter 17 asked how X reaches Y. Moderation asks a different question: when or for whom does X reach Y at all? A price discount may raise sales, but only for price-sensitive segments. A training course may raise performance, but only for new hires. The variable that changes the strength (or direction) of the X-to-Y relationship is called a moderator (Aiken and West 1991).
A moderator changes the slope of X on Y. It is not a mediator (Chapter 17), which explains the mechanism, and it is not a confounder, which biases the estimate of X on Y. The defining feature is that the effect of X depends on the value of the moderator.
A bottom-line lift that is real on average but absent in a large segment is a lift that can be targeted more efficiently. Moderation analysis locates the segments where the effect lives, so the intervention can be priced and placed accordingly.
18.2 The Moderation Model
Moderation is implemented as an interaction term. The linear model becomes Y = b0 + b1 X + b2 W + b3 X W + e. The b3 coefficient on the product X W is the moderation effect: the amount by which the slope of X on Y shifts per unit of W (Cohen, Cohen, West and Aiken 2003).
With X W in the model, b1 is no longer the average slope of X on Y. It is the slope of X when W equals zero. Whether zero is a meaningful value of W is the question centering is meant to answer.
18.3 Fitting an Interaction with lm
The x * w shorthand in R expands to the main effects plus the interaction. The summary prints three coefficients of interest: the conditional slope of X at W equals zero, the conditional slope of W at X equals zero, and the interaction b3.
The price:income row is b3: a positive value means the price slope gets steeper as income rises, a negative value means it flattens. The size of b3 is the change in the price slope per one-unit rise in income.
18.4 Centering Predictors
Centering each predictor on its mean makes zero a meaningful reference point and turns b1 and b2 into average slopes at the mean of the other predictor. The interaction coefficient b3 is invariant to centering; only the main effects change.
Notice that the price:income and price:income_c rows print the same coefficient. What changes between the raw and centred fits is the price main effect, because the reference value of the moderator changed from zero to the sample mean.
18.5 Simple Slopes
The effect of X on Y at a specific value of W is called a simple slope. The standard probing scheme (Aiken and West 1991) evaluates the simple slope at the mean and at one standard deviation below and above the mean of W.
A steeper positive slope at high income than at low income confirms a synergistic interaction. A sign change between low and high income would be a crossover interaction, where the direction of the X to Y effect flips across the moderator’s range.
18.6 Visualising Moderation
The standard picture of a moderated effect is three regression lines: the slope of Y on X at low, medium, and high values of W. A crossing or fanning pattern tells the story at a glance.
Fans that open to the right, fans that close, and lines that cross are all substantively different stories. The picture should guide the interpretation; the numerical probing confirms it.
18.7 Categorical Moderator
When W is a factor, the interaction splits the slope of X across its levels. R’s lm handles this automatically with dummy coding; the interaction rows compare each non-reference level’s slope against the reference.
The price row is the slope inside the reference level (alphabetically first, Online here). Each price:segmentXxx row is the difference between that level’s slope and the reference slope. Summing the two gives the group-specific slope.
18.8 Johnson-Neyman Region of Significance
Simple slopes at three cherry-picked values of W answer the question at three points; the Johnson-Neyman (1936) technique answers it across the entire range of W by plotting the conditional slope and its 95 percent confidence band, then reading off the values of W at which the band excludes zero.
Income values where the confidence band is entirely above (or below) zero are the region where the price effect is reliably different from zero. Values where the band straddles zero are the region where the data are not sharp enough to commit.
18.9 Moderation in Logistic Regression
Moderation in a glm works exactly as in lm, but the interaction coefficient is on the log-odds scale. Exponentiating an interaction term gives the ratio of odds ratios, which tells the reader how much the effect of X on the odds of Y changes per unit of W.
An interaction odds ratio above 1 says the tenure effect makes churn more likely for the non-reference tier relative to the reference. Below 1 says the opposite. The sign of b3 on the log-odds scale and the odds-ratio direction always agree.
18.10 Effect Size for an Interaction
The practical size of a moderation effect is the share of additional variance the interaction adds once the main effects are in the model. This is read off a nested-model comparison as the change in R-squared (or, on a GLM, the change in deviance).
Delta R-squared puts the interaction’s contribution on a zero-to-one scale. The F test from anova asks whether that contribution is larger than sampling noise would produce. Reporting both keeps the practical and statistical pictures separate.
18.11 Moderation versus Mediation
The two frameworks sound similar and are easy to confuse. They answer different questions, use different models, and are rarely interchangeable.
Mediation (Chapter 17) asks through what mechanism X reaches Y and introduces a mediator M on the path X to M to Y. Moderation asks under what condition the effect of X on Y holds and introduces a moderator W that enters as an interaction X times W. A single study can have both: a moderated mediation has an indirect effect whose size depends on W. Hayes (2017) gives the integrated framework.
Whether a variable should be treated as a mediator or a moderator depends on the theoretical claim, not the data. The same third variable can take either role in different studies; the choice is made before fitting the model, not after.
18.12 Reporting a Moderation Analysis
A moderation report reuses the six-section skeleton of Chapters 11 to 17 and adds a probing section.
- Question and hypothesised boundary condition (X, W, and the proposed form of interaction), (2) sample and measurement, (3) fit table with centred predictors and the interaction coefficient, (4) probing: simple slopes at low, mean, high values of W plus the Johnson-Neyman plot, (5) effect size: Delta R-squared and the nested-model F, (6) business decision and the segment where the effect lives. Keeping the skeleton aligned with the Chapter 11 to 17 reports makes descriptive, inferential, predictive, mechanistic, and boundary-condition studies directly comparable.
18.13 Summary
| Concept | Description |
|---|---|
| Model and Form | |
| Moderator definition | A variable that changes the strength or direction of X on Y |
| Y ~ X * W model form | Main effects plus the product term X*W carry the moderation |
| Centering invariance | Interaction coefficient is stable under centering; main effects are not |
| Probing | |
| Simple slopes at low, mean, high | Effect of X on Y at three probing values of W (Aiken and West) |
| Three-line plot | Regression of Y on X drawn at low, mean, high values of W |
| Johnson-Neyman region of significance | Range of W over which the 95 percent CI for the slope excludes zero |
| Variants | |
| Categorical moderator | Dummy-coded factor W; interaction rows are slope differences per level |
| Logistic moderation | Interaction on log-odds; exponentiating gives ratio of odds ratios |
| Two continuous moderators with a three-way term | X, W1, W2, XW1, XW2, W1W2, XW1W2; report carefully, plot often |
| Effect Size and Contrast | |
| Delta R-squared for interaction | Variance the interaction adds once main effects are in; paired with an F test |
| Moderation vs mediation | Different questions: *how* (mediation) vs *when / for whom* (moderation) |
| Crossover vs fan interaction | Lines that cross (crossover) vs lines that fan (fan) imply different stories |
| Reporting | |
| Six-section moderation report | Question, sample, fit, probing, effect size, business decision |
| Centering rule for continuous W | Centre continuous moderators on their mean so main effects are interpretable |