Chapter 6 — Interaction Effects: When One Variable Changes the Effect of Another

By Chapter 6, regression starts becoming realistic.

Until now, all our models quietly assumed: each variable has one fixed effect.

Example:

If deployment increases sales by 10%, then deployment increases sales by 10% for everyone.

But real life rarely behaves that way.

Maybe:

  • deployment helps large customers more,
  • discounts work only in December,
  • some shapes respond differently to pricing.

This is where Chapter 6 begins.

This chapter introduces one of the most important ideas in statistics: Interaction Effects.


What Is an Interaction?

An interaction means: the effect of one variable depends on another variable.

Without interaction:

Effect(X1)=constantEffect(X_1)=constant

With interaction:

Effect(X1)=changes with X2Effect(X_1)=changes\ with\ X_2

That sounds abstract.

So let’s make it practical.


Example — Deployment and Customer Type

Suppose:

You deploy more diamonds. Sales increase.

Great.

But maybe:

Customer typeExtra Sales per $100k Deployment
Small2
Large20

Now deployment effect changes. That is interaction.


The Basic Interaction Model

Ordinary regression:

Y=β0+β1X1+β2X2Y=\beta_0+\beta_1X_1+\beta_2X_2

Interaction model:

Y=β0+β1X1+β2X2+β3X1X2Y=\beta_0+\beta_1X_1+\beta_2X_2+\beta_3X_1X_2

That last term is interaction.


Interpretation of Each Coefficient


Intercept:

β0\beta_0

Baseline.


Main effect:

β1\beta_1

Effect of X1 X_1 when X2=0.X_2=0.


Second main effect:

β2\beta_2

Effect of X2X_2 when X1=0X_1=0.


Interaction:

β3\beta_3

How much one slope changes.


Numerical Example

Suppose:

Sales=100+20Deployment+10Promotion+30(Deployment×Promotion)\text{Sales} = 100 + 20 \cdot \text{Deployment} + 10 \cdot \text{Promotion} + 30 \left( \text{Deployment} \times \text{Promotion} \right)

Interpretation:

Base:

100


Without promotion:

Deployment adds: 20


With promotion:

Deployment adds:

20+30=50

Promotion amplifies deployment.


Why Interaction Exists in Real Life

Because systems are heterogeneous.

Examples:


Discount × Season

Discounts work differently in December.


Customer Count × Month

More customers matter differently by season.


Price × Shape

Price sensitivity differs by shape.


Aging × Inventory Type

Old inventory behaves differently.


Interaction vs Correlation

These are different.

Correlation:

Variables move together.

Interaction:

Variables change each other’s effects.


Example

Height and weight may correlate.

But: medicine effectiveness depending on age is interaction.


Interaction in GLMs

Interaction works exactly the same.

Example:

Poisson regression:

log(μ)=β0+β1X1+β2X2+β3X1X2\log(\mu)=\beta_0+\beta_1X_1+\beta_2X_2+\beta_3X_1X_2

Interpretation changes:

Effects become multiplicative.


Example — Sales Counts

Suppose:

Monthly sales:

log(μ)=2+0.2Discount+0.3December+0.5(Discount×December)\log(\mu) = 2 + 0.2 \cdot \text{Discount} + 0.3 \cdot \text{December} + 0.5 \left( \text{Discount} \times \text{December} \right)

Exponentiate.

Discount effect outside December:

e0.2=1.22e^{0.2}=1.22

22% increase.

Discount effect inside December:

e0.2+0.5e^{0.2+0.5}

=2.01

Now discount doubles sales.

Huge difference.


Interaction in Logistic Regression

Model:

log(p1p)=β0+β1X1+β2X2+β3X1X2\log\left(\frac{p}{1-p}\right)=\beta_0+\beta_1X_1+\beta_2X_2+\beta_3X_1X_2

Interpretation:

Odds ratio changes.


Example:

Customer count changes purchase probability differently by month.


Continuous × Continuous Interaction

Example:

Price × Deployment.

Model:

Sales=β0+β1Price+β2Deployment+β3(Price×Deployment)\text{Sales} = \beta_0 + \beta_1 \cdot \text{Price} + \beta_2 \cdot \text{Deployment} + \beta_3 \left( \text{Price} \times \text{Deployment} \right)

Meaning:

Price sensitivity changes as deployment changes.


Continuous × Categorical

Example:

CustomerCount × Region.

Interpretation:

Customer growth behaves differently across regions.


Categorical × Categorical

Example:

Shape × Color.

Interpretation:

Preference combinations.


Why Interaction Terms Are Estimated

You asked this earlier:

Why do we add interaction terms?

Because:

we do not know interaction strength.

Model estimates:

β3\beta_3

from data.

If:

β3=0\beta_3=0

No interaction.


If: large: Strong interaction.


Hierarchical Principle

Very important.

If you include:

X1X2X_1X_2

always include:

X1X_1

and:

X2X_2

Never include interaction alone.


Real Business Example

Suppose:

You want inventory forecasting.

Model:

log(μ)=β0+β1Month+β2CustomerCount+β3Month×CustomerCount\log(\mu)=\beta_0+\beta_1Month+\beta_2CustomerCount+\beta_3Month\times CustomerCount

Interpretation:

Customer growth behaves differently by season.

Exactly the type of problem you were discussing.


Splines and Interaction

Now suppose customer count effect is nonlinear.

Then:

f(CustomerCount)f(CustomerCount)

instead of:

βCustomerCount\beta CustomerCount

Now:

interaction becomes:

Month×f(CustomerCount)Month\times f(CustomerCount)

This enters: GAM territory.

Very powerful.


Visualization of Interaction

Without interaction:

Parallel lines.

With interaction:

Lines diverge.

That visual intuition is important.


Statistical Testing

How do we know interaction matters?

Compare:

Model 1:
No interaction

Model 2:
Interaction

Use:

  • likelihood ratio test,
  • deviance,
  • AIC,
  • BIC.

Inventory Example

Suppose:

December demand:

high.

Customer growth:

high.

Interaction captures:

December amplifies customer effect.

Without interaction:

inventory underestimated.


Chapter 6’s Big Lesson

Chapter 6 teaches:

variables do not act alone.

Effects depend on context.

And averages often hide reality.


Final Thought

Before Chapter 6:

you ask:

“What is the effect?”

After Chapter 6:

you ask:

“Does the effect change?”

That shift changes everything.

Interaction effects turn regression from:

simple prediction

into

understanding how systems actually behave.

Leave a comment