Signature
tau = (Y_T1 - Y_T0) - (Y_C1 - Y_C0)
| Inputs | Definition | Unit |
|---|---|---|
Y_T1 | Mean outcome of the treated group in the period after the policy starts | outcome unit |
Y_T0 | Mean outcome of the treated group in the period before the policy | outcome unit |
Y_C1 | Mean outcome of the comparison group in the period after the policy starts | outcome unit |
Y_C0 | Mean outcome of the comparison group in the period before the policy | outcome unit |
tau | Estimated effect of the policy on the treated group's mean outcome | outcome unit, such as admissions per 1,000 residents per year |
|---|
Function
Difference-in-differences estimate of a policy effect from treated and comparison groups
Maps outcomes observed before and after a policy in a group exposed to it and a group that is not to an estimate of the policy's average effect on the exposed: the change in the exposed group minus the change in the comparison group. Fixed differences between the groups and shocks common to both cancel. The estimate is causal only under parallel trends and no anticipation. The notation follows the Difference-in-Differences article.
Try this function
Implementations
Excel
Two-by-two difference-in-differences from named group means
With the four means in cells named TreatedAfter, TreatedBefore, ComparisonAfter and ComparisonBefore, the formula returns the estimate, held in a cell named DiDEstimate.
=(TreatedAfter-TreatedBefore)-(ComparisonAfter-ComparisonBefore)
Assumptions
Parallel trends in the absence of the policy
Without the policy the treated group's mean would have changed by the same amount as the comparison group's. The assumption concerns changes, not levels, and is sensitive to scale: trends parallel in rates need not be parallel in log rates.
No anticipation and no spillovers in a difference-in-differences design
The policy has no effect before it starts, and one unit's outcome does not depend on another unit's treatment, so the comparison group is not affected by the policy.
Same outcome definition and scale in all four difference-in-differences cells
All four means use the same measure, population base and period length; a change of coding or denominator in one cell shifts the estimate.
Worked examples
Difference-in-differences for a care-coordination payment and emergency admissions
In the article's illustration region A falls from 52.0 to 47.0 admissions per 1,000 and region B from 48.0 to 46.0, so the estimate is minus 5.0 minus minus 2.0, or minus 3.0 per 1,000 per year.
Y_T1 = 47; Y_T0 = 52; Y_C1 = 46; Y_C0 = 48; tau = -3
Card and Krueger difference-in-differences for the New Jersey minimum wage rise
Card and Krueger's Table 3 reports mean full-time-equivalent employment per store of 20.44 before and 21.03 after in New Jersey and 23.33 and 21.17 in eastern Pennsylvania. The rounded means give 0.59 minus minus 2.16, or 2.75; Card and Krueger report 2.76 from unrounded data.
Y_T1 = 21.03; Y_T0 = 20.44; Y_C1 = 21.17; Y_C0 = 23.33; tau = 2.75
Placebo estimate across two pre-policy years
Applying the same formula to 2021 and 2023, both before the policy, gives (52.0 minus 58.0) minus (48.0 minus 50.0), or minus 4.0, where a value near zero would be expected under parallel trends.
Y_T1 = 52; Y_T0 = 58; Y_C1 = 48; Y_C0 = 50; tau = -4
Common errors
Reporting a before-and-after change in place of a difference-in-differences estimate
In the first example region A's fall of 5.0 includes the national fall of 2.0 seen in region B, so a before-and-after comparison overstates the effect by two-thirds.
Comparing the groups after the policy only
In 2025 region A has 47.0 admissions per 1,000 against 46.0 in region B, which suggests harm, because region A started higher; the fixed gap must be removed.
Accepting a passed pre-trend test as proof of parallel trends
Pre-trend tests often have low power, and proceeding only when a pre-test is passed can distort estimates and confidence intervals.
Sources
Sample-analogue two-by-two estimator and its identifying assumptions
Roth J, Sant'Anna PHC, Bilinski A, Poe J. What's trending in difference-in-differences? A synthesis of the recent econometrics literature. Journal of Econometrics. 2023;235(2):2218-2244 (read as arXiv 2201.01194 version 3). Section 2: under parallel trends and no anticipation the canonical design identifies the ATT, estimated by the sample analogue (mean change in the treated group minus mean change in the untreated group between periods 1 and 2); parallel trends is sensitive to functional form; SUTVA rules out spillovers; pre-trend tests often have low power and conditioning on them can distort inference.
Card and Krueger group means for the New Jersey difference-in-differences
Card D, Krueger AB. Minimum wages and employment: a case study of the fast-food industry in New Jersey and Pennsylvania. American Economic Review. 1994;84(4):772-793 (read as NBER Working Paper 4509, 1993). Table 3: FTE employment per store before 23.33 (Pennsylvania) and 20.44 (New Jersey), after 21.17 and 21.03; change minus 2.16 and 0.59; difference NJ minus Pa in the change 2.76 (standard error 1.36).
Canonical Identity
Stable URI · Machine-readable · Resolvable · CC BY 4.0