Interaction
Terms
Learn how two predictors can work together to influence an outcome: when the effect of one variable depends on the level of another.
What Is an Interaction?
In regression, an interaction occurs when the effect of one independent variable on the dependent variable changes depending on the value of another independent variable. The two predictors are not just additive: they modify each other's influence.
Additive vs. Interactive Effects
Why Interactions Matter in Business
The Interaction Model Equation
A regression with two predictors and their interaction is written:
Interpreting \(\beta_3\)
The interaction coefficient \(\beta_3\) tells us how the slope of one predictor changes as the other predictor increases. We can rewrite the model to see this clearly:
The effective slope of \(X_1\) is now \(\beta_1 + \beta_3 X_2\). This slope is not a fixed number: it depends on the current value of \(X_2\).
Main Effects vs. Interaction
| Main Effects Only | With Interaction | |
|---|---|---|
| Model Form | \(\beta_0 + \beta_1 X_1 + \beta_2 X_2\) | \(\beta_0 + \beta_1 X_1 + \beta_2 X_2 + \beta_3 X_1 X_2\) |
| Slope of \(X_1\) | Constant: \(\beta_1\) | Varies: \(\beta_1 + \beta_3 X_2\) |
| Graph Lines | Parallel | Non-parallel (may cross) |
| Assumption | Effects are independent | Effects are synergistic |
| Parameters | 3 (\(\beta_0, \beta_1, \beta_2\)) | 4 (\(\beta_0, \beta_1, \beta_2, \beta_3\)) |
Continuous × Categorical Interactions
A very common business scenario: one predictor is continuous (e.g., price) and the other is categorical (e.g., region: East vs. West). The categorical variable is coded as a dummy (\(D = 0\) or \(1\)).
Intercept: \(\beta_0\), Slope: \(\beta_1\)
Intercept shifts by \(\beta_2\), slope shifts by \(\beta_3\)
Continuous × Continuous Interactions
When both predictors are continuous, the interaction creates a surface rather than distinct lines. The effect of \(X_1\) varies smoothly as \(X_2\) changes.
How to Build an Interaction Model
Example 1: Coffee Shop Sales
A coffee shop studies how temperature (\(X_1\), in \(^{\circ}\text{F}\)) and whether it's a weekday or weekend (\(D = 0\) weekday, \(D = 1\) weekend) affect daily iced coffee sales (\(Y\)).
Each \(1^{\circ}\text{F}\) increase adds 0.8 sales.
Each \(1^{\circ}\text{F}\) increase adds 1.1 sales.
Example 1: Visualized
Example 2: Online Retail Revenue
An online retailer models revenue (\(Y\), in $1000s) using ad spend (\(X_1\), in $1000s) and customer satisfaction score (\(X_2\), scale 1-10). Both are continuous.
Interpretation: Each additional $1000 in ad spend increases revenue by \(3 + 0.5 X_2\) thousand dollars. If satisfaction is \(X_2 = 4\), the marginal effect is \(3 + 2 = 5\). If satisfaction is \(X_2 = 8\), the marginal effect is \(3 + 4 = 7\).
Example 3: Full Calculation
Using the retail model \(\hat{Y} = 20 + 3X_1 + 4X_2 + 0.5X_1 X_2\), predict revenue when ad spend is \(X_1 = 10\) ($10,000) and satisfaction is \(X_2 = 7\).
Common Mistakes
Summary of Key Concepts
| Concept | Definition | Key Signal |
|---|---|---|
| Main Effect | Direct effect of one predictor alone | Significant \(\beta_1\) or \(\beta_2\) |
| Interaction Term | Product of two predictors (\(X_1 \cdot X_2\)) | Significant \(\beta_3\) |
| No Interaction | Effects are purely additive | Parallel regression lines |
| Positive Interaction | Variables amplify each other | Lines diverge (fan out) |
| Negative Interaction | Variables dampen each other | Lines converge (narrow) |
| Hierarchy Principle | Always keep main effects with interaction | Never drop \(X_1\) or \(X_2\) |
Question 1 of 5
In the model $$Y = \beta_0 + \beta_1 X_1 + \beta_2 X_2 + \beta_3 X_1 X_2 + \varepsilon$$, what does \(\beta_3\) represent?
Question 2 of 5
When you plot predicted \(Y\) against \(X_1\) at different levels of \(X_2\), an interaction is present if:
Question 3 of 5
Given $$\hat{Y} = 5 + 2X_1 + 3X_2 + 0.4X_1 X_2$$, what is the marginal effect of \(X_1\) when \(X_2 = 5\)?
Question 4 of 5
The hierarchy principle in regression states that when you include an interaction \(X_1 X_2\), you should:
Question 5 of 5
A model gives $$\hat{Y} = 10 + 0.8\,\text{Temp} + 5D + 0.3(\text{Temp} \cdot D)$$ where \(D = 1\) for weekends. What is the predicted sales when \(\text{Temp} = 80\) and it is a weekend?