Plan: Lecture 14 — Treatment Effects and Difference-in-Differences

Plan: Lecture 14 — Treatment Effects and Difference-in-Differences

File: 326_14_treatment_did.qmd Outputs: 326_14_treatment_did.html, 326_14_treatment_did.pdf, 326_14_treatment_did_slides.html

Context

New lecture on causal inference for Economics 326 (undergraduate, scalar notation only, no vectors). Based on handwritten notes: Dropbox/Notability/527/DID causal Nov 13, 2025.pdf. Datasets: jtrain2 and kielmc from the wooldridge R package.


Lecture Structure (~36 slides)

Part 1: Potential Outcomes and Treatment Effects (Slides 1–12)

### TitleContent
1Motivation: causal questionsJob training → earnings? Drug → health? Incinerator → house prices? Fundamental challenge: can’t observe same person both ways.
2Potential outcomes$Y_i(1)$, $Y_i(0)$; individual effect $Y_i(1)-Y_i(0)$.
3The fundamental problem$D_i\in{0,1}$; $Y_i = D_i Y_i(1)+(1-D_i)Y_i(0)$; only one PO observed.
4Average treatment effectsATE $=\mathrm{E}[Y_i(1)-Y_i(0)]$; ATT $=\mathrm{E}[Y_i(1)-Y_i(0)\mid D_i=1]$.
5Selection biasNaive diff = ATT + selection bias; add/subtract derivation.
6Random assignmentUnder randomization, selection bias = 0; simple diff = ATE = ATT.
7Regression with a treatment dummy$Y_i=\alpha+\tau D_i+U_i$; $\hat\tau=\bar Y_1-\bar Y_0$; equals ATE if random.
8Example: Lalonde datadata(jtrain2); NSW randomized experiment; head(...).
9Estimating the ATElm(re78 ~ train); estimated ATE ≈ $1,794.
10Observational studiesSelf-selection → selection bias; need covariates.
11Potential outcomes with a covariate$Y_i(0)=\alpha_0+\beta_0 X_i+U_i(0)$; $Y_i(1)=\alpha_1+\beta_1 X_i+U_i(1)$; conditional mean independence.
12The ATE with a covariateATE $=(\alpha_1-\alpha_0)+(\beta_1-\beta_0)\mathrm{E}[X_i]$.

Part 2: Regression with Covariates and Interactions (Slides 13–20)

### TitleContent
13Two separate regressionsOLS for each group; compute ATE from $(\hat\alpha_1-\hat\alpha_0)+(\hat\beta_1-\hat\beta_0)\bar X$.
14Combined regression with interactions$Y_i=\alpha_0+(\alpha_1-\alpha_0)D_i+\beta_0 X_i+(\beta_1-\beta_0)X_i D_i+\tilde U_i$; coefficient on $D_i$ is NOT ATE.
15The demeaning trickSubstitute $X_i=\mathrm{E}[X_i]+(X_i-\mathrm{E}[X_i])$; get $\tau=\text{ATE}$ as coefficient on $D_i$.
16Estimating the ATE with covariatesReplace $\mathrm{E}[X_i]$ by $\bar X$; regress on $D_i$, $X_i$, $(X_i-\bar X)D_i$; coeff on $D_i$ = ATE.
17Why not regress $Y_i$ on $D_i$ and $X_i$?Valid if $\beta_1=\beta_0$; interaction nests simpler model.
18Example: separate regressionslm(re78 ~ educ, subset=train==0/1); compute ATE manually.
19Example: demeaned regressionlm(re78 ~ train + educ + I(train*educ_dm)); coeff on train = ATE.
20Example: regression linesBase R figure: two lines, vertical at $\bar X$, ATE arrow.

Part 3: Difference-in-Differences (Slides 21–36)

### TitleContent
21From cross-sections to panel dataCross-section needed “selection on observables”; panel → exploit within-unit changes.
22DID setupTwo periods $t\in{0,1}$; two groups $D_i\in{0,1}$; treatment between periods.
23DID regression model$Y_{it}=\alpha+\delta t+\gamma D_i+\beta(t\cdot D_i)+U_{it}$; 2×2 table of conditional means.
24Interpreting the coefficients$\alpha$=baseline; $\delta$=time effect; $\gamma$=group diff at $t=0$; $\beta$=DID.
25Deriving the DID estimandFull derivation: $\beta=\mathrm{E}[Y_{i1}-Y_{i0}\mid D_i=1]-\mathrm{E}[Y_{i1}-Y_{i0}\mid D_i=0]$.
26DID diagramBase R: 4-point diagram, counterfactual dashed line, $\beta$ arrow.
27Example: incinerator and house pricesdata(kielmc); Kiel & McClain (1995); head(...).
28The 2×2 table of meanstapply(rprice, list(y81, nearinc), mean); DID by hand.
29DID regressionlm(rprice ~ y81 + nearinc + y81nrinc); matches 2×2 table; p≈0.11.
30DID with covariatesAdd age + I(age^2); DID becomes significant.
31DID and potential outcomesPanel POs $Y_{it}(d)$; what’s observed for each group; ATT definition.
32DID as a treatment effectExpress $\beta$ in terms of POs via add/subtract derivation.
33Assumption 1: no anticipation$\mathrm{E}[Y_{i0}(1)\mid D_i=1]=\mathrm{E}[Y_{i0}(0)\mid D_i=1]$; incinerator interpretation.
34Assumption 2: parallel trends$\mathrm{E}[Y_{i1}(0)-Y_{i0}(0)\mid D_i=0]=\mathrm{E}[Y_{i1}(0)-Y_{i0}(0)\mid D_i=1]$; $\Rightarrow\beta=\text{ATT}$.
35Parallel trends diagramBase R: annotated diagram, equal $\delta$ for both groups, $\beta$=ATT arrow.
36SummaryRecap: POs → ATE/ATT → regression + demeaning → DID → assumptions → ATT.

Datasets

  • jtrain2: Lalonde NSW randomized job training. Variables: train, re78, educ, age, black, married.
  • kielmc: Kiel & McClain housing prices near incinerator. Variables: year, rprice, nearinc, y81, y81nrinc, age.

Formatting

  • YAML: standard (matching 326_13_dummy.qmd), outputs named 326_14_treatment_did.*
  • Hidden macro div: \E, \Var, \Cov, \Vhat, \se immediately after first ##
  • Scalar notation throughout (no vectors)
  • All display math and R chunks indented 2 spaces under a parent bullet
  • Base R figures (#| fig-width: 8, #| fig-height: 5.5, #| fig-align: center)
  • \text{ATE}, \text{ATT} for multi-letter names in math

Implementation steps

  1. Write scratch file (done as scratch_lecture21.qmd)
  2. Fix numbering (21 → 14) and apply to 326_14_treatment_did.qmd
  3. quarto render 326_14_treatment_did.qmd
  4. Grep for katex-error in HTML output
  5. Run proofread-326 agent
  6. Move TODO item to DONE.md
  7. Update course page _teaching/2026-01-Econ-326.md
  8. Update SESSION_NOTES.md