Interaction Terms
in Regression
Discover how the combined effect of two variables can differ from the sum of their individual effects, and why this matters in biostatistics.
What Is an Interaction?
In biostatistics, an interaction occurs when the effect of one predictor variable on the outcome depends on the level of another predictor variable. The relationship between \( X_1 \) and \( Y \) changes as \( X_2 \) changes.
Why Interactions Matter
Visual Intuition: Parallel vs. Crossing Lines
The Regression Model
A standard multiple regression with two predictors and their interaction is:
What \( \beta_3 \) Actually Means
The interaction coefficient \( \beta_3 \) tells us: for every one-unit increase in \( X_2 \), the slope of \( X_1 \) on \( Y \) changes by \( \beta_3 \).
The effect of \( X_1 \) is no longer a single number. It is a function of \( X_2 \). This is the defining feature of an interaction.
Main Effects vs. Interaction Effects
| Main Effect | Interaction Effect | |
|---|---|---|
| Question asked | Does \( X_1 \) affect \( Y \)? | Does the effect of \( X_1 \) change with \( X_2 \)? |
| Coefficient | \( \beta_1 \) (or \( \beta_2 \)) | \( \beta_3 \) |
| Interpretation | One slope for all levels | Slope varies by group |
| Visual cue | Parallel regression lines | Non-parallel or crossing lines |
How to Apply Interaction Terms
Example 1: Drug ✕ Age
A study models blood pressure reduction (\( Y \)) as a function of drug dose (\( X_1 \)) and patient age (\( X_2 \)):
Example 1: Visualized
Example 2: Exercise ✕ Gender
Researchers model cholesterol level (\( Y \)) from weekly exercise hours (\( X_1 \)) and gender (\( X_2 \)): 0 = female, 1 = male):
Example 3: Continuous ✕ Continuous
A model predicts lung function (\( Y \), in liters) from smoking pack-years (\( X_1 \)) and air pollution index (\( X_2 \)):
At pollution index \( X_2 = 20 \): the effect of one more pack-year is:
At low pollution (\( X_2 = 5 \)): the effect is \( -0.05 + (-0.003)(5) = -0.065 \) liters. Smoking is more damaging in high-pollution environments: the two risk factors amplify each other.
Types of Interactions
Reading the Interaction Plot
Common Mistakes
Summary Table
| No Interaction | With Interaction | |
|---|---|---|
| Model | \( Y = \beta_0 + \beta_1 X_1 + \beta_2 X_2 \) | \( Y = \beta_0 + \beta_1 X_1 + \beta_2 X_2 + \beta_3 X_1 X_2 \) |
| Effect of \( X_1 \) | Constant: \( \beta_1 \) | Varies: \( \beta_1 + \beta_3 X_2 \) |
| Plot appearance | Parallel lines | Non-parallel or crossing lines |
| Clinical meaning | Same effect in all subgroups | Effect differs by subgroup |
| Test | Not needed | \( H_0\!: \beta_3 = 0 \) |
Question 1 of 5
In the model \( Y = 10 + 3X_1 + 2X_2 + 0.5(X_1 \cdot X_2) \), what is the effect of a one-unit increase in \( X_1 \) when \( X_2 = 4 \)?
Question 2 of 5
In an interaction plot, parallel lines indicate:
Question 3 of 5
Why is it important to keep main effects in a model that includes an interaction term \( X_1 \cdot X_2 \)?
Question 4 of 5
A model shows \( \hat{Y} = 50 - 2X_1 + 4X_2 + 0.8(X_1 \cdot X_2) \). The interaction term \( \beta_3 = 0.8 \) means:
Question 5 of 5
A qualitative interaction is one where: