Regression Foundations
A reading guide — why the design matrix you choose decides which questions your regression can answer.
Section one
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:
| Suburban | Urban | |
|---|---|---|
| Regular teachers | 75 | 57 |
| Teach for America | 75 | 66 |
10 TFA fellows (4 suburban, 6 urban), 10 regular teachers (7 suburban, 3 urban).
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):
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):
with b0 = 66, b1 = 9, b2 = −9, b3 = 9:
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:
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.
Two mechanical rules.
Section two
The mental map. How the pieces connect, and how to read the deck.
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.
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.
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.
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.
Every example in the back half of the deck is the same test wearing different clothing:
| Setting | b3 asks |
|---|---|
| TFA × urban | does the program work differently in urban schools? |
| Treatment × post | did the treated group gain more than the common trend? |
| Treatment × female | does the drug work differently for women? |
| Minority × female | is 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.
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.
| Slides | What they are doing | What to take away |
|---|---|---|
| 2–3 | The research question and the group means | Memorise the 2×2: 75/57 and 75/66. |
| 4–8 | The arithmetic | Pooled: no difference. Within urban: 9 points. |
| 9–13 | Why the pooled comparison fails | Selection into school type. This is OVB with no algebra. |
| 14–17 | The cell-means design matrix | Coefficients are group means; no intercept possible. |
| 18–20 | The reference-group design matrix | Additive coding; recover any mean from the design matrix row. |
| 21–24 | Hypothesis testing and contrasts | Six possible comparisons; which ones does your model test? |
| 25–27 | Coefficients as contrasts | Each of b1, b2, b3 names a real question. |
| 28–30 | Pre-post designs and compound effects | DiD and the race×sex penalty as the same test. |
| 31–35 | Differential treatment response | Blood pressure and diet pills, with and without an interaction. |
| 36 | A different reference group | Same means, coefficients 75, −18, 0, 9. |
| 37–41 | Number of groups | k levels, k−1 dummies; never interact within a factor. |
| 42–46 | Venn diagrams | Group structure as a control variable. Back to p-10. |
Section three
This deck has no closing checklist. These are the things to be able to do.