Math for Causal Inference
All simulators

The 2×2 Difference-in-Differences

Four means, a parallel counterfactual, and what levels-versus-logs and trend violations do to the estimate.

Day 67: Difference-in-Differences: the 2×2 Case
30405060beforeafteroutcomeDiD 6.0true Y(0)
DiD (levels)
6.00
true ATT
6.00
bias
0.00
DiD in logs
0.078
ATT in logs 0.111
treatedcomparisonDiD counterfactual (parallel)true untreated outcome

Mean outcomes before and after a policy for the treated group (blue) and a comparison group (grey). DiD assumes the treated group would have followed the dashed path, parallel to the comparison group in levels. Choose how the untreated world really evolves (parallel in levels or proportional growth) and add a violation to see the bias.