Why Conditional Slopes Matter
In a regression model without an interaction, the slope for one predictor is constant across values of the other predictors. An interaction allows that slope to vary. This matters when, for example, the association between a risk score and an outcome may differ by exposure level. The model can describe that variation, but an interaction by itself does not establish a causal relationship.
This tutorial focuses on interactions between two continuous predictors in ordinary least squares regression. It shows how to interpret slopes at specified covariate values, calculate their uncertainty, and test whether adding the interaction improves fit. These methods are aligned with the SOA Exam SRM (Statistics for Risk Modeling) syllabus.
Reading the Coefficients as Conditional Slopes
The coefficient \(\beta_1\) is not generally the slope for \(X\) at every value of \(Z\). Holding \(Z=z\) fixed, collect the terms involving \(X\):
This is a straight line in \(X\) at the chosen value \(z\). Therefore, its slope is \(\beta_1+\beta_3z\). By the same reasoning, holding \(X=x\) fixed gives a slope for \(Z\) of \(\beta_2+\beta_3x\).
The value zero must have a meaningful interpretation. If zero is outside the useful range of a predictor, the corresponding main-effect coefficient may be difficult to explain. Centering a predictor can make the reference value more useful: replacing \(Z\) with \(Z_c=Z-c\) makes the \(X\) main-effect coefficient the slope when the original \(Z=c\). Centering changes the coefficient interpretations, but it does not change fitted values when the model is re-expressed correctly.
The interaction coefficient also has a direct interpretation. If \(\beta_3\) is positive, the slope for \(X\) increases by \(\beta_3\) for each one-unit increase in \(Z\); if it is negative, that slope decreases. This describes a change in slope, not necessarily a positive or negative association at every value of \(Z\).
Worked Example: A Slope at a Specified Covariate Value
A hypothetical insurer models annual claim cost \(Y\), in thousands of dollars, using a prevention score \(X\) and years of policy tenure \(Z\). The fitted conditional mean is
Find the slope for prevention score at ten years of tenure, the slope for tenure at a prevention score of ten, and the fitted mean at \(X=10,\ Z=5\). Interpret the interaction.
Method. Use the conditional-slope formulas, then substitute the requested predictor values into the fitted mean.
At \(Z=10\), the slope for \(X\) is
Thus, at ten years of tenure, a one-point increase in prevention score is associated with a fitted decrease of \(0.3\) thousand dollars, or \$300, in annual claim cost, holding tenure fixed.
At \(X=10\), the slope for \(Z\) is
That is a fitted increase of \(0.28\) thousand dollars, or \$280, per additional year of tenure at a prevention score of ten.
At \(X=10,\ Z=5\), the fitted mean is
The fitted mean is \$8,400. The positive interaction coefficient means that the slope for prevention score increases by \(0.02\) thousand dollars per score point for each additional year of tenure. At ten years, the slope is still negative, as calculated above.
Common mistake avoided: Reporting \(-0.5\) as the prevention-score slope at every tenure value ignores the interaction. It is the slope only at \(Z=0\).
Uncertainty in a Conditional Slope
An estimated conditional slope combines coefficient estimates. Its standard error must therefore account for the uncertainty in both estimates and their covariance. For a fitted model, let \(\widehat{\beta}_1\) and \(\widehat{\beta}_3\) be coefficient estimates. At \(Z=z\), the estimated slope is \(\widehat{\beta}_1+z\widehat{\beta}_3\), and its variance is
This follows from the variance rule \(\operatorname{Var}(A+B)=\operatorname{Var}(A)+\operatorname{Var}(B)+2\operatorname{Cov}(A,B)\), with \(A=\widehat{\beta}_1\) and \(B=z\widehat{\beta}_3\). Because \(z\) is fixed, \(\operatorname{Var}(z\widehat{\beta}_3)=z^2\operatorname{Var}(\widehat{\beta}_3)\), and \(\operatorname{Cov}(\widehat{\beta}_1,z\widehat{\beta}_3)=z\operatorname{Cov}(\widehat{\beta}_1,\widehat{\beta}_3)\).
Under the normal-error linear model, a confidence interval for this one linear combination uses a \(t\) critical value and the residual degrees of freedom. A coefficient table’s individual standard errors are not enough to calculate the conditional-slope standard error: the covariance between the estimates is also needed.
Worked Example: Standard Error and Interval for a Conditional Slope
In a hypothetical regression, the estimated coefficients for \(X\) and \(XZ\) are \(\widehat{\beta}_1=0.4\) and \(\widehat{\beta}_3=0.2\). Their estimated variances are \(0.25\) and \(0.04\), respectively, and their covariance is \(-0.02\). At \(Z=2\), calculate the estimated slope, its standard error, and a 95% confidence interval. Assume the model has 20 residual degrees of freedom and use \(t_{0.975,20}=2.086\).
Method. First calculate the conditional slope, then use the variance of a linear combination. Keep unrounded values until the interval endpoints are calculated.
The estimated slope at \(Z=2\) is
Its estimated variance is
Therefore, the standard error is \(\sqrt{0.33}=0.574456\ldots\). The 95% confidence interval is
Rounded to four decimals at the final step, the interval is \((-0.3983,\ 1.9983)\). Since it includes zero, these results do not show that the conditional slope differs from zero at the 5% two-sided level.
Common mistake avoided: Omitting the covariance term would give the wrong variance. Here the covariance contribution is \(2(2)(-0.02)=-0.08\); it is not zero and must be included.
Testing Whether the Interaction Improves Fit
To test whether the interaction contributes to the model, compare a full model containing the product \(XZ\) with a reduced model that retains both main effects but omits the product. The null hypothesis is \(H_0:\beta_3=0\); the alternative is \(H_A:\beta_3\ne0\). Retaining both main effects is important: the comparison asks whether the interaction adds information beyond the two predictors’ separate linear effects.
The models must use the same response and observations, and the reduced model must be nested in the full model. Under the usual linear-model assumptions, if the full model has \(p_F\) estimated parameters including the intercept and the two models differ by \(q\) parameters, the partial F statistic is
Here \(SSE_R\) and \(SSE_F\) are the residual sums of squares for the reduced and full models, and \(n\) is the sample size. Under the null hypothesis and the model assumptions, this statistic has an \(F\) distribution with \(q\) and \(n-p_F\) degrees of freedom.
The numerator measures the reduction in residual sum of squares per added parameter. The denominator is the full model’s residual mean square. Under the null, both quantities estimate the same error variance, so their ratio should not usually be large. A large value is evidence against the null. For a single interaction coefficient, \(q=1\); the partial F test is equivalent to squaring the usual \(t\) statistic for that coefficient.
Worked Example: Nested-Model Test for an Interaction
A hypothetical study fits a reduced regression with two continuous predictors and an intercept, then a full regression that adds their interaction. Both models use the same 32 observations. The reduced-model residual sum of squares is \(80\), and the full-model residual sum of squares is \(56\). Test the interaction at the 5% level. The full model has four parameters including its intercept.
Method. Apply the partial F test. The models differ by the single interaction coefficient, so \(q=1\), and the full-model residual degrees of freedom are \(32-4=28\).
The numerator mean square for the added term is
The full-model residual mean square is
Thus,
with 1 and 28 degrees of freedom. The 5% critical value is approximately \(4.20\), and \(12>4.20\). Reject \(H_0\) at the 5% level: adding the interaction improves fit in this comparison.
Common mistake avoided: Comparing the full model with a model that omits one of the main effects as well as the interaction would not isolate the interaction’s contribution. The reduced model here retains both main effects.
Interpret the Test Alongside the Slopes
A significant nested-model test is evidence that the interaction coefficient is not zero under the stated model; it does not say that the conditional slope is positive at every covariate value, that the effect is practically large, or that the relationship is causal. Conversely, a slope at one particular \(Z=z\) may be estimated imprecisely even when the interaction test is significant. The test concerns change in slope across values of \(Z\); a conditional-slope test concerns the slope at one specified value.
Before interpreting results, check the units and range of both predictors. A one-unit change might mean one year, one percentage point, or a much larger scale change. Slopes should be reported with those units, and predictions at covariate combinations far outside the observed data range should be treated cautiously.
Confirm that the product term is present and identify which variable is held fixed.
For the slope of \(X\), calculate \(\widehat{\beta}_1+z\widehat{\beta}_3\).
Use both coefficient variances and their covariance to find the slope’s standard error.
Keep the main effects in the reduced model, calculate the partial F statistic, and compare it with the appropriate reference distribution.
Common Exam Traps
- Reading a main effect as a universal slope. In an interaction model, \(\beta_1\) is the slope for \(X\) only when \(Z=0\).
- Leaving out the product’s contribution. At \(Z=z\), the \(X\) slope includes \(z\beta_3\), with the sign determined by the estimated interaction coefficient.
- Dropping the covariance term. A linear combination’s variance includes twice the covariance contribution; it may increase or decrease the result.
- Using the wrong reduced model. To test the interaction alone, retain the two main effects and remove only the interaction term.
- Confusing fit with practical importance. A statistically detectable improvement does not by itself establish a large or useful effect.
Check Your Understanding
For each problem, identify the requested conditional effect or model comparison before calculating.
- A fitted model is \(\widehat{Y}=4+1.2X-0.4Z+0.06XZ\). Find the slope for \(X\) at \(Z=8\), and state how much that slope changes when \(Z\) rises from 3 to 8. (Answer: slope \(1.68\); increase \(0.30\).)
- At \(Z=4\), the estimates for \(\beta_1\) and \(\beta_3\) have variances \(0.09\) and \(0.01\), and covariance \(0.015\). Find the standard error of the estimated \(X\) slope. (Answer: variance \(0.37\); standard error \(\sqrt{0.37}\approx0.6083\).)
- A reduced model retains two main effects; the full model adds their single interaction. With \(n=25\), \(SSE_R=142\), \(SSE_F=118\), and five full-model parameters, calculate the partial F statistic and decide at 5%, using critical value \(4.35\). (Answer: \(F=24/(118/20)\approx4.0678\); do not reject at 5%.)
- A fitted model uses \(Z_c=Z-10\) and has coefficients \(\widehat{\beta}_1=0.7\) and \(\widehat{\beta}_3=-0.05\). Find the slope for \(X\) at original \(Z=14\), and state the \(X\) slope at the centering value. (Answer: at \(Z=14\), \(0.7-0.05(4)=0.50\); at \(Z=10\), \(0.70\).)
- For a one-parameter interaction test, the reduced and full residual sums of squares are \(210\) and \(174\). If \(n=40\) and the full model has four parameters, calculate \(F\) and compare with the 5% critical value \(4.11\). (Answer: \(F=36/(174/36)\approx7.4483\); reject the null at 5%.)