Why a Three-Way Interaction Needs a Conditional Interpretation
A two-way interaction describes how the association with one predictor depends on another. A three-way interaction asks whether that two-way interaction itself changes with a third predictor. It is therefore not enough to read the three-way coefficient as a standalone effect: its meaning is a change in a specified two-way interaction, on the model’s link scale.
Consider two binary factors, \(A\) and \(B\), coded 0 or 1, and a continuous predictor \(x\). In a hierarchical generalized linear model (GLM), include all lower-order terms along with the three-way product. A hierarchical specification makes the conditional interpretation explicit and avoids omitting lower-order terms while retaining their product.
Here \(\mu\) is the conditional mean of the response, \(g\) is the GLM link, and \(\eta\) is the linear predictor. The coefficient \(\beta_{ABx}\) multiplies the product \(ABx\). The reference condition is \(A=0,\ B=0\); the units and origin of \(x\) must also be stated. If \(x\) is centered, \(x=0\) refers to its centering value, not necessarily to a zero measurement.
Deriving the Conditional Two-Way Interaction
For each fixed \(x\), define the \(A\)-by-\(B\) interaction contrast on the linear predictor as the predictor at \(A=1,B=1\), minus the predictors at \(A=1,B=0\) and \(A=0,B=1\), plus the predictor at \(A=0,B=0\). This difference-in-differences cancels all terms that do not involve both \(A\) and \(B\).
To see the cancellation directly, the four predictors are \(\eta(1,1,x)=\beta_0+\beta_A+\beta_B+\beta_xx+\beta_{AB}+\beta_{Ax}x+\beta_{Bx}x+\beta_{ABx}x\), \(\eta(1,0,x)=\beta_0+\beta_A+\beta_xx+\beta_{Ax}x\), \(\eta(0,1,x)=\beta_0+\beta_B+\beta_xx+\beta_{Bx}x\), and \(\eta(0,0,x)=\beta_0+\beta_xx\). Substituting these expressions leaves exactly \(\beta_{AB}+\beta_{ABx}x\). Thus the interaction changes between \(x_1\) and \(x_2\) by \(\beta_{ABx}(x_2-x_1)\). This derivation applies to the linear predictor; what the contrast means in terms of the response depends on the link.
Worked Examples Across GLM Links
Worked Example: Identity-Link Interaction at Two Values of a Predictor
A hypothetical service study models a continuous outcome using a Gaussian GLM with identity link. Let \(A\) indicate a service feature, \(B\) indicate a customer group, and let \(x\) be months of prior experience, measured from a defined baseline. The fitted linear predictor is \(\eta=10+2A-B+0.5x+1.2AB+0.4Ax-0.2Bx-0.3ABx\). Calculate the \(A\)-by-\(B\) interaction at \(x=0\) and \(x=2\), and explain the three-way coefficient.
Method. With the identity link, \(\mu=\eta\), so the link-scale interaction contrast is also a difference-in-differences in conditional means.
At \(x=0\), the four predicted means are: \(A=0,B=0:\ 10\); \(A=1,B=0:\ 10+2=12\); \(A=0,B=1:\ 10-1=9\); and \(A=1,B=1:\ 10+2-1+1.2=12.2\). Therefore, \(\Delta_{AB}(0)=12.2-12-9+10=1.2\).
At \(x=2\), the four predicted means are: \(A=0,B=0:\ 10+0.5(2)=11\); \(A=1,B=0:\ 11+2+0.4(2)=13.8\); \(A=0,B=1:\ 11-1-0.2(2)=9.6\); and \(A=1,B=1:\ 11+2-1+1.2+0.4(2)-0.2(2)-0.3(2)=13.0\). Thus, \(\Delta_{AB}(2)=13.0-13.8-9.6+11=0.6\).
The result also follows from \(\Delta_{AB}(x)=1.2-0.3x\): it gives 1.2 at \(x=0\) and 0.6 at \(x=2\). The three-way coefficient, \(-0.3\), says the mean-scale two-way interaction decreases by 0.3 outcome units per additional month of \(x\). Common mistake avoided: treating 1.2 as the interaction at every \(x\); it is the interaction only at \(x=0\).
Worked Example: A Three-Way Interaction Under the Log Link
A hypothetical Poisson GLM models event counts per equal exposure unit. \(A\) and \(B\) are binary program indicators, and \(x\) is a continuous score in its original units. Suppose \(\beta_A=\log(1.2)\), \(\beta_{AB}=\log(1.5)\), \(\beta_{Ax}=\log(1.1)\), and \(\beta_{ABx}=\log(0.8)\). Find the rate ratio for changing \(A\) from 0 to 1 within each level of \(B\) at \(x=0\) and \(x=2\), then compare those rate ratios.
Method. For a Poisson model with log link, the difference in linear predictors exponentiates to a rate ratio. At fixed \(B\) and \(x\), the rate ratio for changing \(A\) from 0 to 1 is \(\exp(\beta_A+\beta_{AB}B+\beta_{Ax}x+\beta_{ABx}Bx)\). The ratio of the \(A\) rate ratios at \(B=1\) and \(B=0\) is therefore \(\exp(\beta_{AB}+\beta_{ABx}x)\).
At \(x=0\), the \(A\) rate ratio at \(B=0\) is \(\exp(\log(1.2))=1.2\). At \(B=1\), it is \(\exp(\log(1.2)+\log(1.5))=1.2(1.5)=1.8\). Their ratio is \(1.8/1.2=1.5\), agreeing with \(\exp(\beta_{AB})\).
At \(x=2\), the \(A\) rate ratio at \(B=0\) is \(\exp(\log(1.2)+2\log(1.1))=1.2(1.1)^2=1.452\). At \(B=1\), it is \(\exp(\log(1.2)+\log(1.5)+2\log(1.1)+2\log(0.8))=1.8(1.1)^2(0.8)^2=1.39392\). The ratio of these rate ratios is \(1.39392/1.452=0.96\), equivalently \(1.5(0.8)^2=0.96\).
The three-way coefficient is \(\log(0.8)\), so each one-unit increase in \(x\) multiplies the \(B=1\) versus \(B=0\) ratio of \(A\) rate ratios by 0.8. The interaction contrast at \(x=2\) is a ratio of rate ratios of 0.96, not a difference of rates. Common mistake avoided: adding the log-link coefficients and calling the sum a response-scale change; exponentiation is needed to obtain rate ratios.
Worked Example: Reading the Interaction on the Logit Scale
A hypothetical binary-outcome study uses a logistic GLM. \(A\) and \(B\) are binary indicators, and \(x\) is a continuous risk score. Suppose \(\beta_{AB}=-0.4\) and \(\beta_{ABx}=0.25\). Calculate the \(A\)-by-\(B\) interaction in log odds and as a ratio of odds ratios at \(x=-1\) and \(x=3\).
Method. The logit link is \(g(\mu)=\log(\mu/(1-\mu))\). The interaction contrast on the linear predictor is consequently a difference-in-differences in log odds. Exponentiating that contrast gives the corresponding ratio of odds ratios.
At \(x=-1\), the log-odds interaction is \(-0.4+0.25(-1)=-0.65\). The ratio of odds ratios is \(\exp(-0.65)\approx0.5220\).
At \(x=3\), the log-odds interaction is \(-0.4+0.25(3)=0.35\). The ratio of odds ratios is \(\exp(0.35)\approx1.4191\). The interaction changes by \(0.35-(-0.65)=1.00\) over the four-unit increase in \(x\); this equals \(0.25(3-(-1))=1.00\).
Thus the three-way coefficient is a 0.25-unit increase in the log-odds interaction per unit of \(x\). It does not imply a constant change in probability: the logit model’s probability depends on the full linear predictor. Common mistake avoided: interpreting a log-odds interaction as a fixed probability difference.
Interpreting and Reporting the Result
A useful interpretation states the outcome scale, both factor levels being compared, the values or units of the continuous predictor, and the scale of the interaction. Under an identity link, the contrast is a difference-in-differences in conditional means. Under a log link, its exponential is a ratio of rate ratios. Under a logit link, its exponential is a ratio of odds ratios. For other links, the contrast remains a linear-predictor contrast, but its response-scale meaning must be derived for that link rather than assumed.
The coefficient \(\beta_{ABx}\) is tied to the coding and units used. Reversing a factor’s reference category changes the signs and meanings of affected coefficients, while changing the unit of \(x\) changes the numerical size of the per-unit coefficient. A statement such as “the interaction increases by 0.2” is incomplete unless it identifies the scale and the unit. Likewise, if \(x\) is centered at 5, \(\beta_{AB}\) describes the interaction at \(x=5\), not at \(x=0\) on the original scale.
State which factor level is coded 1, the reference levels, the unit and origin of \(x\), and the link function.
For the specified hierarchical model, calculate \(\Delta_{AB}(x)=\beta_{AB}+\beta_{ABx}x\) at each requested value.
Keep the contrast on the link scale, or apply the appropriate inverse-link interpretation, such as exponentiating a log-link or logit-link contrast.
Confirm the contrast’s sign and direction by checking which cell values are added and subtracted, or by comparing the relevant rate ratios or odds ratios.
A three-way term can be important even if a two-way coefficient is small, because the conditional interaction may differ substantially across the observed range of \(x\). Conversely, a nonzero \(\beta_{ABx}\) describes a change on the model scale, not proof that the predictors have a causal effect. Interpret it in the context of the fitted model and the available data.
Common Exam Traps
- Calling \(\beta_{AB}\) the interaction everywhere. It is the interaction at \(x=0\); at another value, include \(\beta_{ABx}x\).
- Leaving out the lower-order terms. In a hierarchical model with \(ABx\), include \(AB\), \(Ax\), \(Bx\), and the main effects to give the model its standard conditional interpretation.
- Confusing the link-scale and response-scale results. A linear-predictor contrast is not automatically a difference in means, rates, odds, or probabilities. Use the specified link.
- Ignoring units and coding. A per-unit interaction depends on how \(x\) is measured, while factor reference levels determine which comparisons the coefficients describe.
- Using an incomplete contrast. For binary \(A\) and \(B\), the interaction is \(\eta_{11}-\eta_{10}-\eta_{01}+\eta_{00}\), not merely the predictor for \(A=1,B=1\).
Check Your Understanding
For each problem, identify the conditional interaction and use the stated link to interpret it.
- A Gaussian identity-link model has \(\beta_{AB}=0.6\) and \(\beta_{ABx}=0.2\), with \(x\) measured in years from its stated origin. Calculate the \(A\)-by-\(B\) mean interaction at \(x=1\) and \(x=4\), and its change between them. (Answer: 0.8 and 1.4 outcome units; increase of 0.6 outcome units.)
- A Poisson log-link model has \(\beta_{AB}=\log(2)\) and \(\beta_{ABx}=\log(0.5)\). Find the ratio of rate ratios at \(x=0\) and \(x=3\), and state the multiplier for a one-unit increase in \(x\). (Answer: 2 at \(x=0\), 0.25 at \(x=3\), and 0.5 per one-unit increase.)
- A logistic model has \(\beta_{AB}=0.3\), \(\beta_{ABx}=-0.1\), and \(x=2\). Calculate the log-odds interaction and ratio of odds ratios. (Answer: 0.1 log-odds units and \(\exp(0.1)\approx1.1052\).)
- In a Poisson log-link model, the \(A\) rate ratio is 1.4 when \(B=0\) and 2.1 when \(B=1\), both at \(x=0\). Find the link-scale \(A\)-by-\(B\) interaction at \(x=0\). (Answer: \(\log(2.1/1.4)=\log(1.5)\approx0.4055\), with ratio of rate ratios 1.5.)
- A model has \(\beta_{AB}=-0.2\) and \(\beta_{ABx}=0.15\). Calculate the conditional interaction at \(x=-2\) and \(x=2\), and the change across that interval. (Answer: \(-0.5\) and \(0.1\) link-scale units; increase of \(0.6\) link-scale units.)