Difference-in-Differences: Estimation and Design
A practical lesson on estimating difference-in-differences, evaluating its causal assumptions, checking design credibility, and handling staggered treatment timing.
How the DiD Estimate Works
How the DiD estimate works
estimates a policy’s effect by comparing the outcome change in a treated group with the change over the same period in a comparison group. With two groups and two periods, calculate:
First find how much the treated group changed. Then subtract how much the comparison group changed. This second change accounts for shifts over time shared by both groups.
The source’s example gives the treated group an outcome of 10 before and 15 after, a change of . The comparison group goes from 8 to 11, a change of . Thus:
The estimate is 2 units: the treated group’s outcome rose 2 more units than it would have if it had changed like the comparison group. It is not the post-treatment gap, which is . The groups already differed before treatment, so comparing only their after-period outcomes would not isolate the difference in changes.
DiD is quasi-experimental: treatment is not randomly assigned. Its causal interpretation relies chiefly on a credible comparison of outcome trends, not—as in an instrumental-variables design—on an instrument that shifts treatment. With two groups and two periods, a regression containing treatment-group and post-period indicators gives the same DiD estimate through their . For panel data, researchers commonly add unit and time fixed effects.
| Group | Before | After | Change |
|---|---|---|---|
| Treated | 10 | 15 | +5 |
| Comparison | 8 | 11 | +3 |
The and
The and
The key causal assumption in DiD is . It says that, in the absence of treatment, the treated group’s average outcome would have changed over time at the same rate as the comparison group’s outcome. In potential-outcomes notation, for a before and after period, this can be written as:
Here, means the outcome without treatment, and and identify the treated and comparison groups. The equality is about changes in untreated outcomes. It does not require that the groups start at the same outcome level, have identical characteristics, or end up with identical actual outcomes after treatment.
The treated group’s untreated outcome after treatment is a : it cannot be observed at the same time as the treated outcome. Consequently, cannot be directly verified after treatment. Researchers use institutional knowledge and diagnostics to judge whether it is plausible. Similar movement before treatment is reassuring, but it cannot prove that the groups would have continued on parallel paths. If, for example, the groups face different local demand shocks, their outcomes might have changed differently even without the policy. Covariate adjustment can help when the assumption is plausible within comparable covariate groups; it cannot make a fundamentally unsuitable comparison credible.
New Jersey and Pennsylvania
In April 1992, New Jersey raised its minimum wage from $4.25 to $5.05 per hour, while Pennsylvania’s remained at $4.25. Card and Krueger surveyed fast-food restaurants in New Jersey and eastern Pennsylvania before and after the policy. New Jersey restaurants were the treated group and Pennsylvania restaurants the comparison group. The study compared employment changes rather than only employment levels after the law.
The reported DiD estimate was an increase of about 2.5 employees per restaurant in New Jersey relative to Pennsylvania. The authors found no indication that the increase reduced employment in their sample. The design’s logic is that common changes affecting both areas would be differenced out. But that interpretation depends on Pennsylvania providing a credible trend for New Jersey. Local trend differences, changes in which restaurants were represented, spillovers across the state border, and measurement error could threaten the comparison. The result illustrates the method; it does not establish a universal effect for every minimum-wage increase or labor market.
Checking a DiD Design
Checking a DiD design
A DiD estimate is more credible when the comparison group and the identifying assumption withstand several checks. These diagnostics can reveal problems, but none establishes causality on its own.
Inspect pre-treatment patterns. Plot outcome levels and changes over several periods before treatment, including group means and uncertainty. Similar pre-treatment movement supports the plausibility of , but does not demonstrate that the unobserved trend would have remained parallel after treatment.
Read event studies cautiously. An displays estimated effects by time relative to treatment. Pre-treatment leads can reveal visible departures from , while post-treatment lags describe how effects evolve. Failure to reject zero pre-treatment effects is not proof of : the test may have low power. Choosing a specification because it passes a pre-trend test can also distort later inference.
Try placebo and alternative-comparison checks. Test outcomes or dates that should not respond to the policy. Check whether results persist with defensible alternative comparison groups, outcome definitions, and sample restrictions. These checks help diagnose concerns; passing them does not prove the design is causal.
Check who is observed and when. Ask whether the policy changed the observed group, encouraged behavior before its formal start (anticipation), or affected the comparison group (spillovers). Also consider missing data, closures, migration, and other policies introduced at the same time.
Match uncertainty calculations to treatment assignment. If a policy is assigned at the state level, uncertainty calculations should reflect the limited number of states. Treating every individual observation as an independent policy assignment would not reflect how the treatment was assigned.
Staggered Treatment Timing
Staggered treatment timing
When places or groups begin treatment at different times, a single two-way fixed-effects regression can combine comparisons in unintuitive ways. If treatment effects vary across groups or over time, some comparisons may use already-treated units as controls. The resulting coefficients need not equal a simple average of causal effects, so a conventional two-way fixed-effects estimate should not be relied on automatically.
A clearer design starts by specifying the target : which causal effect is the analysis meant to measure? Then choose comparison groups that are untreated or not yet treated during the relevant period. Researchers can also consider methods designed for , such as group-by-time treatment effects, which make the comparison and target effect explicit.
: The unit or jurisdiction at which treatment is assigned.