Regression Foundations

Hypothesis Testing with Dummy Variables

A reading guide — why the design matrix you choose decides which questions your regression can answer.

Section one

Key concepts

The example, the two parameterizations, and the rules, each stated as a claim.

Key concepts

The motivating example: Teach for America.

Average math score (percentile) by group:

SuburbanUrban
Regular teachers7557
Teach for America7566

10 TFA fellows (4 suburban, 6 urban), 10 regular teachers (7 suburban, 3 urban).

  • Pooled comparison: TFA = (4·75 + 6·66)/10 = 69.6; regular = (7·75 + 3·57)/10 = 69.6. No difference.
  • Within suburban schools: 75 vs 75. No difference.
  • Within urban schools: 66 vs 57. A 9-point difference.

The pooled comparison hides the effect because TFA fellows are concentrated in urban schools and regular teachers in suburban ones. Comparing programs without controlling for environment leads us to conclude TFA is not working when it is.

Two ways to write the same model.

Cell-means (fully interacted, no intercept):

math = b1d.sub.tfa + b2d.sub.reg + b3d.urb.tfa + b4d.urb.reg

Each coefficient is a group mean: 75, 75, 66, 57. There is no intercept — the four dummies sum to a column of 1s, so including one would be perfect multicollinearity.

Reference-group (additive with interaction):

math = b0 + b1d.sub + b2d.reg + b3d.sub.reg

with b0 = 66, b1 = 9, b2 = −9, b3 = 9:

  • b0 = 66 — urban TFA (the reference group)
  • b0 + b1 = 75 — suburban TFA
  • b0 + b2 = 57 — urban regular
  • b0 + b1 + b2 + b3 = 66 + 9 − 9 + 9 = 75 — suburban regular

You can always recover the group means.

No matter which groups you omit, you can always recover the group means. You just multiply all coefficients by the appropriate row in the design matrix.

Why not use the cell-means model?

Because each coefficient would be tested against zero, and “is this group mean zero?” is not a research question. We already know the means are not zero. The cell-means model makes group means easy to read and makes hypothesis testing impossible.

The contrasts you actually want.

With four groups A, B, C, D there are six pairwise comparisons:

  • H1: A = B? Do regular teachers perform differently in urban and suburban schools?
  • H2: B = D? Do regular and TFA teachers differ in urban schools?
  • H3: A = C? Do regular and TFA teachers differ in suburban schools?

The reference-group parameterization turns three of these into direct tests of b1 = 0, b2 = 0, and b3 = 0.

The interaction is a test against a counterfactual.

  • b0 + b1 + b2 = the additive expectation (the counterfactual)
  • b0 + b1 + b2 + b3 = what is actually observed
  • Testing b3 = 0 asks whether the combination is simply additive

Two mechanical rules.

  • A factor with k levels becomes k dummies, of which one must be omitted as the reference.
  • Dummies from the same categorical variable cannot be interacted — the product is always zero, because the categories are mutually exclusive.

Section two

Key relationships

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

The specification decides which questions you can ask

This is the thesis, and it is a different point from anything earlier in the sequence.

Both models in this deck are the same model. Same four group means, same fitted values, same R2, same residuals. Nothing about the description of the data changes when you switch between them.

What changes is which comparisons the software puts a p-value on. Every regression tests each coefficient against zero. So the parameterization you choose determines which contrasts get tested for free — and which ones you would have to compute by hand.

The design matrix is a research-question decision, not a formatting choice. That is the sentence to carry away.

Choose your reference group so the tested contrast is the one you care about

It follows that omitting a different group changes what the coefficients mean — and the deck shows exactly this. With urban TFA as the reference, b0 = 66, b1 = 9, b2 = −9, b3 = 9. With suburban regular as the reference, the same data give 75, −18, 0, 9.

Both recover all four group means. But they hand you different default tests.

So the practical workflow is backwards from what students usually do: decide which comparison answers your research question first, then pick the reference category that makes that comparison a single coefficient.

The TFA example is omitted variable bias, in table form

Before any regression appears, slides 3 through 13 have already made the argument from p-07 using nothing but arithmetic. Run it through bias = α1β2:

Both channels are open, so omitting environment biases the program comparison. And here the bias is large enough to cancel the effect exactly — 69.6 versus 69.6.

Notice which direction it runs. This is the case p-05 warned about in reverse: not a false positive manufactured by bias, but a false negative. The naive analysis concludes the program does not work. A program that helps in urban schools gets defunded because more of its teachers are in urban schools.

Why the pooled comparison is not just noisy but wrong

It is tempting to read the 69.6 = 69.6 result as “the effects cancel out.” They do not cancel; they were never comparable in the first place.

The pooled TFA average is 40% suburban and 60% urban. The pooled regular average is 70% suburban and 30% urban. You are comparing two differently-weighted mixes of two different populations. The number is a weighted average of things that should not be averaged together.

This is the same structure as p-10’s heterogeneity bias and the blood-pressure reversal: the between-group comparison and the within-group comparison are different quantities, and only the second answers the causal question.

The interaction always tests “is the combination additive?”

Every example in the back half of the deck is the same test wearing different clothing:

Settingb3 asks
TFA × urbandoes the program work differently in urban schools?
Treatment × postdid the treated group gain more than the common trend?
Treatment × femaledoes the drug work differently for women?
Minority × femaleis the wage penalty more than the sum of its parts?

In every case b0 + b1 + b2 is the counterfactual — what you would expect if the two factors acted independently — and b3 is the gap between that expectation and reality.

Once you see this, the difference-in-differences model from p-08 stops being a special technique and becomes an instance: DiD is just treatment × time, and the parallel-trends assumption is just the claim that the additive counterfactual is the right one.

The two mechanical rules, and why they hold

Why one dummy must be omitted. The full set of dummies for a factor sums to a column of ones, which is exactly what the intercept already is. Including both is perfect multicollinearity — the extreme end of p-10’s second sin — and the software will silently drop one for you. Better to choose which one.

Why same-variable dummies cannot be interacted. White × Black is zero for every observation, because no one is both. An interaction asks “what happens when both conditions hold,” and for mutually exclusive categories that never happens. Interactions are for combinations across factors, not within one.

How to read the slides

SlidesWhat they are doingWhat to take away
2–3The research question and the group meansMemorise the 2×2: 75/57 and 75/66.
4–8The arithmeticPooled: no difference. Within urban: 9 points.
9–13Why the pooled comparison failsSelection into school type. This is OVB with no algebra.
14–17The cell-means design matrixCoefficients are group means; no intercept possible.
18–20The reference-group design matrixAdditive coding; recover any mean from the design matrix row.
21–24Hypothesis testing and contrastsSix possible comparisons; which ones does your model test?
25–27Coefficients as contrastsEach of b1, b2, b3 names a real question.
28–30Pre-post designs and compound effectsDiD and the race×sex penalty as the same test.
31–35Differential treatment responseBlood pressure and diet pills, with and without an interaction.
36A different reference groupSame means, coefficients 75, −18, 0, 9.
37–41Number of groupsk levels, k−1 dummies; never interact within a factor.
42–46Venn diagramsGroup structure as a control variable. Back to p-10.

Section three

What should be clear in my mind?

This deck has no closing checklist. These are the things to be able to do.

  1. Explain why the pooled TFA comparison shows no effect. Selection into school environments, which is correlated with both program and outcome.
  2. Write both design matrices for a 2×2 and recover all four group means from either.
  3. Say why the cell-means model cannot test your hypothesis even though it displays the group means most clearly.
  4. Translate a research question into a coefficient test by choosing the reference category.
  5. State what an interaction tests — whether the joint effect exceeds the additive expectation.
  6. Explain the two mechanical rules: omit one dummy per factor; never interact dummies from the same factor.

Key takeaways