Did the measure change anything? (difference-in-differences)
In brief
A measure hits one group (the treated), another it does not (the comparison group). Both are measured before and after. The change of the treated alone says little, because something changes over time even without the measure. The comparison group shows roughly how much. So the change of the comparison group is subtracted from the change of the treated: the difference of the differences (difference-in-differences). This holds only under one assumption: without the measure both groups would have moved in parallel (parallel trends). With one point in time before, it cannot be checked from the data, only argued.
An example with real data
321 house sales in North Andover (Massachusetts), 1978 and 1981, prices in 1978 dollars. Houses near a planned waste incinerator are compared with the others. The other houses rose on average from 82,517.23 to 101,307.51 (+18,790.29), the houses near the plant from 63,692.86 to 70,619.24 (+6,926.38). The difference-in-differences is −11,863.90: near the plant prices rose about 11,900 dollars less. The regression with interaction gives the same number, plus the standard error 7,456.65 (p = .113; robust 8,635.59, p = .170): that is not clearly different from zero. With area, rooms and age in the model it is −11,479.40 (standard error 5,302.66, p = .031; robust 6,237.81, p = .067). The statement stays uncertain.
When do I use it?
When a measure, a law, a plant or a programme hits only part of the cases and there are measurements before and after, for treated cases and for others. The comparison group must be similar to the treated one so that parallel trends are plausible.
Requirements
- Parallel trends: without the measure both groups would have moved in parallel. With several points in time before one can look at the paths; Statable so far calculates two points in time (before, after).
- No reaction beforehand: the groups must not have reacted to the expected measure, and nothing else may have hit only one of the groups.
- Group and time as 0 and 1 in two columns (1 = treated, 1 = after); all four groups need cases.
How it works in Statable
- Open Examples > "House prices and a waste incinerator (Kiel and McClain)" (economics) and run the regression "preis from nahe_anlage and nachher".
- Under the result, at "Calculate differently", open the block "Did the measure change anything? (difference-in-differences)" (Ctrl+K: "difference-in-differences"); outcome "preis", group column "nahe_anlage", time column "nachher", optionally add area, rooms and age; "Calculate difference-in-differences".
The first table shows the four means with the changes and the difference; the second the regression with classical and robust standard errors. The script for R can be saved.
Reading and reporting the result
Prices of the houses near the plant rose by 6,926 dollars from 1978 to 1981, those of the others by 18,790 dollars. The difference-in-differences was −11,864 dollars (SE = 7,457, p = .113; robust SE = 8,636).
Limits
- The parallel-trends assumption remains an assumption. A clear p value does not prove it.
- The standard errors hold for larger samples. Few treated units or few groups make them too small. Statable so far calculates neither clusters nor a staggered introduction of the measure.
What is often misunderstood
Sources
Wooldridge, J. M. Introductory Econometrics (difference-in-differences, dataset kielmc after Kiel & McClain 1995; data in the R package wooldridge, GPL). Cunningham, S. Causal Inference: The Mixtape, chapter Difference-in-Differences (mixtape.scunning.com, freely available). Huntington-Klein, N. The Effect, chapter Difference-in-Differences (theeffectbook.net, freely available). Own words, no exercise from a book.
Take away
- The change of the comparison group shows what would have happened anyway without the measure; it is subtracted from the change of the treated.
- The difference-in-differences holds only if both groups would have moved in parallel.
- With one point in time before, this assumption cannot be checked, only argued.
- A non-significant result means: the data are too uncertain, not: no effect.