01 / 21

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.

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

Precision
Ignoring an interaction produces biased estimates: you get the "average" effect, not the true effect for subgroups.
Clinical Decisions
Treatment may help one group but harm another. Interaction terms reveal this hidden pattern.
Study Design
Understanding interactions helps plan trials with adequate power for subgroup analyses.

Visual Intuition: Parallel vs. Crossing Lines

No Interaction Dose Outcome Group A Group B Lines are parallel: same slope With Interaction Dose Group A Group B Lines cross: different slopes

The Regression Model

A standard multiple regression with two predictors and their interaction is:

\( \beta_1 \)
Main effect of \( X_1 \): effect when \( X_2 = 0 \)
\( \beta_2 \)
Main effect of \( X_2 \): effect when \( X_1 = 0 \)
\( \beta_3 \)
Interaction coefficient: how much the effect of \( X_1 \) changes per unit increase in \( X_2 \)

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

1
Fit the model with the interaction term: include \( X_1 \), \( X_2 \), and \( X_1 \cdot X_2 \) as predictors.
2
Test significance of \( \beta_3 \): check the p-value. If \( p < 0.05 \), the interaction is statistically significant.
3
Interpret conditional effects: compute the effect of \( X_1 \) at specific values of \( X_2 \) using \( \beta_1 + \beta_3 \cdot X_2 \).
4
Visualize: plot predicted \( Y \) vs. \( X_1 \) at low, medium, and high values of \( X_2 \). Look for non-parallel lines.
5
Keep main effects in the model: always include both \( X_1 \) and \( X_2 \) even if their main effects are not significant.

Example 1: Drug ✕ Age

A study models blood pressure reduction (\( Y \)) as a function of drug dose (\( X_1 \)) and patient age (\( X_2 \)):

Age = 30
Effect of dose: \( 2.0 + (-0.03)(30) = \) 1.1 mmHg per unit dose
Age = 70
Effect of dose: \( 2.0 + (-0.03)(70) = \) -0.1 mmHg per unit dose

Example 1: Visualized

Drug Dose (units) BP Reduction (mmHg) 0 5 10 15 20 0 10 20 30 Age 30 Age 50 Age 70

Example 2: Exercise ✕ Gender

Researchers model cholesterol level (\( Y \)) from weekly exercise hours (\( X_1 \)) and gender (\( X_2 \)): 0 = female, 1 = male):

Females (\( X_2 = 0 \))
Effect of exercise: \( -5 + 3(0) = \) -5 mg/dL per hour
Males (\( X_2 = 1 \))
Effect of exercise: \( -5 + 3(1) = \) -2 mg/dL per hour

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

Synergistic
Combined effect is greater than sum of individual effects. The interaction amplifies the response.
Antagonistic
Combined effect is less than the sum. One factor dampens the other's effect.
Qualitative
The direction of the effect reverses. A treatment helps one subgroup but harms another.

Reading the Interaction Plot

Predictor \(X_1\)
Outcome \(Y\)
Low \(X_2\)
High \(X_2\)
Synergistic Group A Group B Qualitative

Common Mistakes

✕ Dropping Main Effects
Including \( X_1 \cdot X_2 \) but removing \( X_1 \) or \( X_2 \) from the model violates the hierarchy principle and produces uninterpretable coefficients.
✕ Over-interpreting Main Effects
When an interaction is present, \( \beta_1 \) is the effect of \( X_1 \) only when \( X_2 = 0 \). It is not the "overall" effect.
✕ Ignoring Centering
Without centering continuous variables, main effects can be hard to interpret because \( X_2 = 0 \) may be outside the data range.

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: