MaizePrepSTATS 250
Exam 3 · Lec 20

Interactions and different slopes

Let one predictor’s association depend on another predictor.

25 minDraft

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

Interaction model
y^=β^0+β^1x+β^2IB+β^3xIB\hat y=\hat\beta_0+\hat\beta_1x+\hat\beta_2I_B+\hat\beta_3xI_B
In R, y ~ x * group expands to main effects plus their interaction.
Slope and gap
slopeB=β^1+β^3,y^B−y^A=β^2+β^3x\text{slope}_B=\hat\beta_1+\hat\beta_3,\qquad \hat y_B-\hat y_A=\hat\beta_2+\hat\beta_3x
Test H0: beta_3 = 0 to assess evidence of different population slopes.

Which procedure?

Research question asks whether slopes differ across groups
Include and test the numeric-by-group interaction.
Equal slopes are plausible and a simpler model is justified
Consider a parallel-lines model; a large p-value does not prove equality.
Worked example

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.0171
  1. Paved: fitted minutes = 5 + 2(km).

  2. Gravel: fitted minutes = 8 + 2.5(km).

  3. At 4 km, the gravel-minus-paved difference is 3 + 0.5(4) = 5 minutes.

  4. The interaction p-value provides strong evidence that the population slopes differ. It tests a slope difference, not the group gap at every distance.

Answer

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

1
Lec 20

For y-hat = 7 + 4x + 6I_B − xI_B, the B slope is:

2
Lec 20

In that model, the B−A gap at x = 2 is:

3
Lec 20

Testing the interaction coefficient against zero asks whether:

MaizePrep is an independent study resource. It is not affiliated with, sponsored by, or endorsed by the University of Michigan. Course names and numbers are used only to describe which class the material covers. Every practice question is original, written in the style of the course.