Regression Foundations

Interactions in Regression Models

A reading guide for lecture p-08 — difference-in- differences, varying slopes by group, and why every coefficient is a comparison.

Section one

Key concepts

The two interaction models and how to read their coefficients.

Key concepts

An interaction is a product term, and it always asks whether the effect differs by group.

  1. Dummy × dummy — the difference-in-difference model
  2. Dummy × continuous — varying program impact (slopes) by group

Difference-in-differences: interacting two dummies.

Y = b0 + b1 · Treat + b2 · Post + b3 · (Treat · Post) + e
CoefficientLabelMeaning
b0Acomparison group, before
b1Btreatment group offset, before
b2Cchange over time common to both groups
b3Dthe program effect
  • Comparison group, after: A + C
  • Treatment group, before: A + B
  • Treatment group counterfactual, after: A + B + C
  • Treatment group, actually observed after: A + B + C + D

In the worked example b0 = 20, b1 = 15, b2 = 10, b3 = 20: the counterfactual is 45, the observed outcome is 65, and the program effect is the 20 between them.

The comparison group supplies the counterfactual trend.

Both groups would have moved by b2 anyway. The interaction term isolates the extra movement in the treatment group — the part the common trend does not explain.

Dummy × continuous: letting the slope vary by group.

height = b0 + b1dumA + b2dumB + b3fertilizer + b4(dumA · fertilizer) + b5(dumB · fertilizer) + e

With Type C as the omitted reference category:

  • b0 = height of Type C at fertilizer = 0 — the reference intercept
  • b1 = how much higher Type A starts than Type C — an intercept shift
  • b3 = the effect of fertilizer for Type C — the reference slope
  • b4 = the difference in fertilizer slope between Type A and Type C
  • Fertilizer slope for Type A = b3 + b4

The reference category is arbitrary; the fit is not.

The deck runs the same model with different groups omitted. Every coefficient changes, and R2 stays at 0.59. You are re-describing the same fitted lines from a different baseline.

Section two

Key relationships

The mental map. How the pieces connect, and how to read the deck.

Main effects shift intercepts; interactions shift slopes

This is the sentence that organises the whole deck.

In the corn example you can see both at once: Type A starts 8.98 units above Type C (b1, an intercept shift) and responds to fertilizer differently (b4, a slope shift). Type A’s line is flat, Type B’s rises steeply, Type C’s falls. Without the interaction terms the model would be forced to give all three the same slope and would fit none of them.

So the diagnostic question is: do I think the groups start at different levels, respond at different rates, or both? Each answer maps to a specific term.

Every coefficient is a comparison to the omitted group

Interaction models are hard to read because nothing means what it appears to mean in isolation. Everything is relative to whichever category you left out.

The four-model table drives this home. Same data, same fitted lines, same R2 = 0.59 — and completely different numbers, because each model uses a different reference group. If you ever find yourself surprised that a coefficient changed sign when you re-coded a factor, this is why.

Practical habit: before interpreting any interaction model, say out loud which group is the baseline. Every number in the output is an answer to “compared to that.”

Difference-in-differences is the same trick with a purpose

The DiD model is just dummy × dummy — but the two dummies are chosen so the interaction has a causal reading.

The setup gives you four cells: treated and untreated, before and after. Three of them tell you what you need to construct a counterfactual:

The fourth cell is what actually happened. The gap is b3.

This is why the counterfactual line on the slide is dashed: it is not data. It is constructed from the comparison group’s trend, transplanted onto the treatment group’s starting level.

The assumption hiding in the dashed line

Worth being explicit, because the slides show the mechanics rather than the caveat: DiD assumes the two groups would have moved in parallel absent the program. That is what licenses using the comparison group’s change as the treatment group’s counterfactual.

Notice what this buys you. The two groups are allowed to differ in level — that is exactly what b1 absorbs, and it is why DiD is useful when treatment was not randomly assigned. What they are not allowed to differ in is trend.

Look again at the first example: the treatment group starts at 55 and the comparison at 75. They are not comparable groups. DiD does not care, as long as both were on track to improve by the same amount.

How this connects to the rest of the sequence

That last point is worth holding onto. The comparison-group design is not just a convenience — it is a way of neutralising unmeasured differences without ever naming them, which is the same ambition as randomization, achieved by a different route.

How to read the slides

SlidesWhat they are doingWhat to take away
1–2FramingTwo kinds of interaction, one idea.
3The two-group, two-period plot75→95 and 55→85. Compute the DiD yourself before turning the page.
4The counterfactual addedThe dashed line is constructed, not observed.
5–6The regression versionMap A, B, C, D onto b0 through b3.
7Framing part twoNow the slopes vary.
8Intercept termsb0 is Type C’s intercept; b1 is A’s offset from it.
9Slope termsb3 is C’s slope; b4 is the difference; A’s slope is b3 + b4.
10Four models, four baselinesSame R2, different coefficients. The reference category is a choice.

Section three

What should be clear in my mind?

This deck has no closing checklist, so these are the things to be able to do.

  1. Read a difference-in-difference table. Given b0 through b3, state all four cell means and identify which one is the counterfactual.
  2. Say what the interaction coefficient means. It is the difference in differences — the extra change in the treatment group beyond the common trend.
  3. Recover a group’s slope from an interaction model. Reference group: b3. Any other group: b3 plus its own interaction term.
  4. Name the omitted category before interpreting anything. Every coefficient is relative to it.
  5. State the parallel-trends assumption and explain why differing levels between groups are acceptable but differing trends are not.

Key takeaways