What Is Difference-in-Differences (DiD)? Parallel Trends and Procedure
What Is Difference-in-Differences?
Difference-in-differences (DiD) estimates the effect of a treatment such as a policy, program, or institutional change by subtracting the before-after change in a control group from the before-after change in the treated group. A simple before-after comparison mistakes any change that would have happened anyway for a treatment effect; DiD removes that by using the control group's change as the counterfactual of what would have happened without treatment.
It is the most widely used quasi-experimental design for policy evaluation when random assignment is impossible. The classic example is Card and Krueger (1994), who compared fast-food employment in New Jersey with neighboring Pennsylvania after New Jersey raised its minimum wage.
When Should You Use Difference-in-Differences?
Use it when treatment cannot be randomly assigned, you observe outcomes both before and after treatment, and a comparable untreated group exists. Panel data is ideal, but repeated cross-sections drawn from the same population at each time point also work.
| Situation | Suitability |
|---|---|
| A policy is introduced only in certain regions or institutions | Suitable (adopters = treated, non-adopters = control) |
| No observations before treatment | Unsuitable (no before-after comparison is possible) |
| Treated and control groups already trend differently before treatment | Unsuitable (parallel trends violated) |
| Treatment timing differs across groups | Possible, but requires staggered-adoption estimators |
How Is the DiD Estimate Calculated?
In a 2×2 table, compute the before-after difference for the treated group and for the control group, then subtract the second from the first. That double difference is the DiD estimate.
| Group | Before | After | Change |
|---|---|---|---|
| Treated | A | B | B − A |
| Control | C | D | D − C |
| DiD | (B − A) − (D − C) |
In regression form, include a treated-group dummy (Treat), a post-treatment dummy (Post), and their interaction (Treat × Post); the interaction coefficient is the DiD estimate. Covariates and unit and time fixed effects can be added.
What Is the Parallel Trends Assumption?
It is the assumption that, absent treatment, the outcomes of the treated and control groups would have moved along the same trend. The causal interpretation of DiD depends entirely on it. Because the untreated path of the treated group after treatment is never observed, the assumption cannot be tested directly; it is checked indirectly by whether the two groups trended in parallel across several pre-treatment periods.
| Check | What it does |
|---|---|
| Pre-trend plot | Plot both groups' mean outcome by period before treatment and compare |
| Event study | Confirm that coefficients on pre-treatment period dummies are close to zero |
| Placebo test | Assign a fake treatment date before the real one and confirm no effect appears |
How Do You Run a Difference-in-Differences Analysis?
Define groups and timing, check parallel trends, estimate the regression model, then confirm robustness.
Step 1: Define Treated and Control Groups and the Treatment Date
Establish exactly who was treated and when, and choose a control group comparable to the treated group. The control group must not be affected by the treatment even indirectly.
Step 2: Check Parallel Trends
Examine pre-treatment outcome trends with a plot and an event study. If trends diverge, rebuild the control group with propensity score matching or control for group-specific linear trends.
Step 3: Estimate the Regression Model
Fit the model with the Treat × Post interaction. Because outcomes within a group are correlated over time, cluster standard errors at the level where treatment was assigned (region, institution, and so on).
Step 4: Run Robustness Checks and Report
Confirm that the estimate is stable under placebo tests, alternative control groups, and the inclusion or exclusion of covariates. Report the interaction coefficient with clustered standard errors and the parallel trends evidence, alongside the 2×2 table or an event-study plot.
What If Treatment Timing Differs Across Groups?
With staggered adoption, where a policy reaches different regions in different years, the two-way fixed effects (TWFE) model can be biased because it uses already-treated units as controls. When effects vary across time or groups, use a staggered-adoption estimator such as Callaway and Sant'Anna (2021) and report effects by time since treatment in event-study form.
What Are Common Mistakes in Difference-in-Differences?
Reporting results without checking parallel trends, failing to cluster standard errors and thereby overstating significance, and claiming to have checked pre-trends with only one observation before treatment are the most common. Effects are also distorted when the treated group anticipates the policy and changes behavior beforehand.
Summary
Difference-in-differences follows define groups and timing, check parallel trends, estimate the interaction-term regression, run robustness checks, and its credibility rests on how convincing the parallel trends assumption is. The regression foundation is covered in regression analysis, and comparing the two groups before treatment connects to the t-test.