Advanced level · Module 1: Causal Inference and Programme Evaluation · Lesson 3 of 4
Difference-in-Differences
Estimate effects from before-and-after data in treated and comparison groups, and check the parallel-trends assumption.
In this lesson you will
- Calculate a difference-in-differences estimate
- Check parallel trends and state the assumptions
Key concepts
before–after comparisoncomparison groupparallel trendsregression form of DiD
The lesson
Difference-in-differences (DiD) compares the change over time in a treated group with the change in a comparison group. Subtracting the comparison group's change removes trends that affected both.
Its key assumption is parallel trends: without the programme, both groups would have changed similarly. Check it by plotting several periods before the programme started.
DiD can be estimated with a regression including group, period and their interaction, which adds standard errors and control variables.
Step by step
- Calculate DiD by hand from a two-by-two table.
- Plot pre-programme trends for both groups.
- Estimate DiD with regression.
- Write the assumptions and limits.
Did school feeding raise attendance? A difference-in-differences estimate
Attendance before and after a feeding programme in programme and comparison districts.
| Group | Before (%) | After (%) |
|---|---|---|
| Programme districts | 62 | 74 |
| Comparison districts | 60 | 65 |
| Gap (programme − comparison) | 2 | 9 |
What the data shows
Attendance rose 12 points in programme districts (62 → 74) but also 5 points in comparison districts (60 → 65), probably because of something affecting everyone, such as a good harvest.
The difference-in-differences estimate is (74 − 62) − (65 − 60) = 7 percentage points: the rise beyond what happened anyway. Equivalently, the gap between the groups grew from 2 to 9 points.
Recommendation
Report an estimated effect of about 7 points, with its confidence interval from the regression version, after checking that the two groups had similar attendance trends in earlier terms — the parallel-trends assumption.
Practice activity
Complete the feeding programme DiD analysis from the practical activity.
Expected result: A DiD estimate with trend checks, standard errors and careful conclusions.
Check your understanding
-
What does DiD subtract?
Show answer
The comparison group's change over the same period.
-
What is the parallel-trends assumption?
Show answer
Without the programme, the groups would have changed similarly over time.
Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.