For y-hat = 7 + 4x + 6I_B − xI_B, the B slope is:
Interactions and different slopes
Let one predictor’s association depend on another predictor.
Key ideas
- Interaction
The association between one predictor and the response depends on another predictor’s value. A numeric-by-group interaction permits nonparallel lines.
- Reference slope
The numeric main-effect coefficient is the slope for the group coded zero, not a shared slope for all groups.
- Slope difference
The interaction coefficient is the non-reference slope minus the reference slope. Add it to the reference slope to get the non-reference slope.
- Group difference at x
In an interaction model, the group difference is the indicator coefficient plus x times the interaction coefficient. The indicator alone compares groups only at x = 0.
Formulas
Which procedure?
Road surface and cycling time
Model cycling minutes by route length in km for paved and gravel routes. Paved is the reference category. This is an original example with composed R output.
coef(lm(minutes ~ km * surface, data = routes))
(Intercept) km surfaceGravel km:surfaceGravel
5 2 3 0.5
# Selected interaction row from summary(), residual df = 36
# Estimate = 0.5; SE = 0.2; t = 2.5; p = 0.0171Paved: fitted minutes = 5 + 2(km).
Gravel: fitted minutes = 8 + 2.5(km).
At 4 km, the gravel-minus-paved difference is 3 + 0.5(4) = 5 minutes.
The interaction p-value provides strong evidence that the population slopes differ. It tests a slope difference, not the group gap at every distance.
Each additional kilometer is associated with 0.5 minutes more increase in mean cycling time on gravel than on paved routes. The gravel slope itself is 2.5 minutes per km.
Three-question check
In that model, the B−A gap at x = 2 is:
Testing the interaction coefficient against zero asks whether: