Specialisation B: Data Analytics for Economics

Online MA · Sem 4

Lesson 3 of 4Economics

Difference-in-Differences Estimation

Specialisation B: Data Analytics for Economics

About the video

An intuitive introduction to Difference-in-Differences

Doug McKee

Study notes

Difference-in-differences (DiD) estimates a program's causal effect by comparing the before-after change in a treated group with the before-after change in an untreated control group. It relies on the parallel trends assumption: without the program, both groups would have changed by the same amount. DiD can be computed from four group means or, equivalently, as the interaction coefficient in a regression.

Intuition and setup

  • Used when a program was not randomized and outcomes are observed for a treated and a control group, both before and after implementation.
  • Example: free school lunch in Sao Paulo (treated) from 2009; Rio (control); math test scores in 2008 and 2010.
  • D1 = change over time in treated group = program effect + time trend (e.g., a soccer tournament in 2008 affecting scores).
  • D2 = change over time in control group = estimate of the trend.
  • DiD = D1 - D2.
  • Equivalently: D3 = treated minus control in post period (effect + area differences); D4 = treated minus control in pre period (area differences); DiD = D3 - D4. Both versions are algebraically identical.

When to use DiD vs alternatives

  • Random assignment: simple treatment-control difference is unbiased; DiD may still improve precision.
  • Simple before-after difference only works if nothing else changed over time - rarely reasonable.
  • If assignment depends only on observables, multiple regression with controls works.
  • DiD helps when assignment and other group differences are unknown.
  • Worked example: Sao Paulo scores rose 70, Rio rose 40, so DiD = 70 - 40 = 30 points.

Regression form

  • Y = b0 + b1*Post + b2*Treat + b3*(Post x Treat) + error.
  • E[Y | control, pre] = b0; E[Y | treated, post] = b0 + b1 + b2 + b3.
  • Control change over time = b1; treated change = b1 + b3; DiD = b3, the interaction coefficient.
  • Works with aggregate data, repeated cross-sections, or panel (longitudinal) data; individual data allows more flexible models.
  • Reasons to use regression: automatic standard errors; can add controls X (e.g., socioeconomic status) for differing trends; controls reduce error variance and shrink standard errors.

Validity: parallel trends

  • Pre-existing level differences between groups are fine (e.g., Sao Paulo chosen because kids were worse off).
  • Invalid if trends unrelated to the program differ, e.g., Rio gets its own lunch program at the same time.
  • If either D2-as-trend or D4-as-stable-gap assumption seems doubtful, the DiD estimate is suspect.

Key terms

Difference-in-differences
Change over time in the treated group minus change over time in the control group.
Parallel trends assumption
Absent treatment, treated and control groups would have followed the same trend over time.
Interaction term
Product Post x Treat in the DiD regression; its coefficient is the DiD estimate.
Repeated cross-section
Separate samples drawn in each period and group.
Longitudinal (panel) data
Data observing the same individuals in both periods.

Takeaways

  • DiD = (treated post - treated pre) - (control post - control pre).
  • In regression, the coefficient on Post x Treat is the DiD estimate.
  • Level differences between groups are allowed; differing trends are not.
  • Regression adds standard errors, controls, and precision.
Contribute

Was this lesson helpful?

We read every rating and fix the weakest lessons first.