ECON 410 · Econometrics II: Causal Methods and Time Series

Difference-in-Differences

Compare how a treated group changed with how a similar untreated group changed, and the gap in changes is the effect.

Key takeaways

  • Difference-in-differences subtracts the control group's change from the treated group's change.
  • The first difference removes traits that are fixed within each group; the second removes shocks that hit both groups.
  • The key assumption is parallel trends: without treatment, both groups would have changed by the same amount.
  • You cannot test that assumption directly, but you can look at the years before treatment for warning signs.
  • The method is a close cousin of fixed effects, and it can fail when different groups are treated at different times.

A city raises its minimum wage. Six months later, teenagers in that city work fewer hours a week. Did the higher wage cause the drop?

Maybe. But maybe a slow winter, or a wave of new online ordering, cut hours everywhere. A plain before-and-after comparison cannot separate the wage law from everything else that changed in those six months. And a plain city-to-city comparison cannot separate the law from the permanent ways the two cities differ. Each simple comparison has a hole.

Now picture Noor, an analyst who watches two cities. City T raised its minimum wage. City C, a neighbor with similar jobs, did not. She does not compare the cities' levels, and she does not look at City T alone. She compares how much each city changed. That small shift, comparing changes with changes, is one of the most used tools in applied economics.

Two comparisons that fail, and one that works

Start with the two failures, using Noor's made-up numbers. The outcome is the average hours a teen works per week.

Before the law After the law
City T (raised wage) 24 22
City C (no change) 20 21

Before and after in City T alone. Hours fell from 24 to 22, a drop of 2. But something else may have pushed hours down, so we cannot call this the effect.

After only, T versus C. In the after period T has 22 and C has 21, a gap of +1. That wrongly suggests the law helps hours. The cities differed at the start: T had more hours already, by 4.

Neither comparison is right. But together they hold what we need.

The double subtraction

Use City C as a stand-in for what would have happened to City T without the law. City C's hours rose by 1 (from 20 to 21). If City T would have moved the same way, its hours would have gone from 24 to 25 without the law. Instead they went to 22. The law's effect is the gap between what happened and what would have happened.

Change in City T = 22 − 24 = −2
Change in City C = 21 − 20 = +1
Difference in differences = (−2) − (+1) = −3

The estimated effect is a loss of 3 hours per week. The first subtraction, within each city, strips out each city's permanent traits, such as its size or its mix of jobs. The second subtraction, between the two changes, strips out anything that moved both cities together, such as the weather or the national economy.

The law's effect is the gap from the 'what if' line
Teen hours per week Before After City T actual City C actual City T if no law T after: 22 T no law: 25 Time period Teen hours per week Before After City T actual City C actual City T if no law T after: 22 T no law: 25 Time period

City C rose by 1, so City T would have risen to 25 without the law. It reached 22, a gap of 3 hours.

Where the assumption lives

The estimate is only as good as one assumption, called parallel trends. It says that without treatment, the treated group's outcome would have changed by the same amount as the control group's. Notice what it does not say. It does not say the groups have the same level. City T started 4 hours higher and that is fine. It only says their changes would match.

This is the "missing world" bet for this design, in the language of potential outcomes. We never see City T without the law, so we borrow City C's trend as its stand-in.

You cannot test parallel trends in the period after treatment, because the stand-in world is hidden. But you can look at periods before. Suppose Noor has data for four earlier periods. If City T and City C moved in step for all four, with hours in T always about 4 above C, the bet looks more believable. If T was already drifting down faster than C before the law, then the −3 may partly reflect that drift, not the law.

Here is how a pre-period check might look. Suppose Noor also has two earlier periods. In the happy case, hours for T read 24, 24, 24 and for C read 20, 20, 20 before the law. Both lines were flat, so a fall of 3 hours after the law stands out against steady history.

In the worrying case, T's hours read 26, 25, 24 and C's read 20, 20, 20. City T was already sliding by 1 hour a period. If that slide would have continued, T's hours would have been 23 after the law even without it. The actual figure was 22, so only about 1 hour of the drop is plausibly due to the law, not 3. The same two data points in the after period lead to very different stories, depending on the history. This is why a graph of the pre-period is the first thing a careful reader looks for in any study of this kind.

A routine for a difference-in-differences study
1 Choose the groups One group hit by the policy, and a comparison group that is not. 2 Plot the earlier years Check that both groups were moving in step before the policy. 3 Compute the double difference Change in treated minus change in control. 4 Probe the result Try other control groups and fake policy dates to see if the effect vanishes. Choose the groups One group hit by the policy, and a comparison group that is not. 1 Plot the earlier years Check that both groups were moving in step before the policy. 2 Compute the double difference Change in treated minus change in control. 3 Probe the result Try other control groups and fake policy dates to see if the effect vanishes. 4

Looking at the pre-period is the main defense for the key assumption.

The regression version

Real studies put this in a regression, which also gives standard errors and allows controls. Define Treated = 1 for City T and 0 for City C, and Post = 1 for after the law and 0 for before. The model is:

hours = a + b × Treated + c × Post + d × (Treated × Post)

Plug in the four cells of Noor's table to see what each coefficient means.

City C before (Treated 0, Post 0): a            = 20
City T before (Treated 1, Post 0): a + b        = 24   → b = 4
City C after  (Treated 0, Post 1): a + c        = 21   → c = 1
City T after  (Treated 1, Post 1): a + b + c + d = 22  → d = 22 − 20 − 4 − 1 = −3

The coefficient d on the interaction (Treated × Post) is exactly the double difference, −3. Its meaning: b is the permanent gap between groups, c is the common change over time, and d is the extra change that treated units experienced.

Reading the four regression coefficients
a + b + c + d = T after a = Control, before 20 hours b = Group gap +4 hours c = Common change +1 hour d = Treatment effect −3 hours T after = Treated, after 22 hours a + b + c + d = T after a = Control, before 20 hours b = Group gap +4 hours c = Common change +1 hour d = Treatment effect −3 hours T after = Treated, after 22 hours

If you have many periods and many groups, the regression usually becomes a two-way fixed-effects model, with a baseline for each group and each period, from panel data and fixed effects. The coefficient on a treatment indicator then plays the role of d.

A famous use, and where it can fail

A well-known study of this kind, by David Card and Alan Krueger in 1994, compared fast-food restaurants in New Jersey, which raised its minimum wage in 1992, with restaurants in nearby eastern Pennsylvania, which did not. They found no sign that the higher wage cut employment there, which surprised many economists at the time. The study sparked years of debate over methods, data and what the result meant. Whatever one concludes, it showed how much a careful comparison of changes can reveal, and it is a good example of contested policy evidence: serious researchers have disagreed about the size and even the sign of minimum-wage effects in different settings.

Weak spots to watch for include:

  • Diverging trends. If the groups were already on different paths, the borrowed trend is wrong.
  • Other events at the same time. If City T also opened a big factory in the same month, the law gets credit for it.
  • Changing group makeup. If the people sampled differ between periods, a change may reflect who was surveyed.
  • Spillovers. If workers or firms move from T to C, the control group is no longer untouched.
  • Staggered timing. When many groups adopt a policy in different years and effects grow over time, the usual two-way regression can compare already-treated groups with newly treated ones and give misleading averages. Economists such as Andrew Goodman-Bacon, and Brantly Callaway with Pedro Sant'Anna, have written about this, and newer estimators are built to handle it.

A common mistake: choosing a control group because it is handy

Beginners often pick any untreated group, such as "the rest of the country," without asking whether its trend resembles the treated group's. A better control looks like the treated group in the years before. Compare the next lesson, regression discontinuity, which instead looks right at a cutoff, and synthetic control, which builds a custom control group from a weighted mix of several places.

Words to know

Difference-in-differences a method that compares the change over time in a treated group with the change in a control group.

Parallel trends the assumption that, without treatment, both groups would have changed by the same amount.

Control group the unit or units that do not receive the treatment and provide the stand-in trend.

Interaction term a regression variable made by multiplying two others, here Treated × Post.

Pre-trend the movement of the groups' outcomes in the periods before treatment.

Placebo test a check that pretends treatment happened at a fake time or place and looks for an effect that should not be there.

Staggered adoption a setting where different groups receive treatment in different periods.

Check yourself

  1. In your own words, what does the second "difference" in difference-in-differences remove?
  2. City T goes from 30 to 27 and City C goes from 28 to 29. What is the difference-in-differences estimate?
  3. What would City T's outcome have been without the policy in question 2, under parallel trends?
  4. Why is it fine if the two groups start at different levels?
  5. How can the years before a policy help you judge the key assumption?
  6. In the regression, what does the coefficient on Treated × Post measure?
Show the answers
  1. It removes changes that hit both groups alike, such as weather, the national economy or a general trend.
  2. City T changed by 27 − 30 = −3 and City C by 29 − 28 = +1, so the estimate is −3 − 1 = −4.
  3. City C rose by 1, so City T would have gone from 30 to 31 without the policy.
  4. The method only assumes the groups' changes would match; differences in level are removed by the first subtraction.
  5. If the groups moved in step before the policy, the shared-trend bet is more believable; if they were already diverging, the estimate is suspect.
  6. It measures the extra change in the treated group after the policy, beyond the common time change and the permanent group gap, which is the estimated effect.

A free self-study program written for 4Economics with AI writing tools and not reviewed line by line by a person. It is not an accredited degree and awards no credit. Check anything you rely on against a textbook or primary source. Report an error.

In this unit: Causal designs

  1. The Potential Outcomes FrameworkEvery cause-and-effect claim compares two worlds, but we only ever see one; this is how economists say that precisely.11 min
  2. Randomized ExperimentsFlipping a coin to decide who gets a treatment is the cleanest way to learn what the treatment really does.10 min
  3. Selection Bias and MatchingWhen you cannot flip a coin, you can compare treated people only with untreated people who look just like them.10 min
  4. Instrumental VariablesAn instrument is an outside nudge that shifts who gets treated without touching the outcome any other way.9 min
  5. Two-Stage Least Squares and Weak InstrumentsTwo-stage least squares scales instrument ideas to real data, and a weak first stage can quietly wreck the answer.9 min
  6. Panel Data and Fixed EffectsFollowing the same units over time lets you cancel out every unchanging difference between them.9 min
  7. Difference-in-DifferencesCompare how a treated group changed with how a similar untreated group changed, and the gap in changes is the effect.10 min
  8. Regression DiscontinuityWhen a rule hands out a benefit at a sharp cutoff, people just above and just below it make a natural experiment.10 min
  9. Synthetic ControlBuild a weighted "twin" of one treated place from untreated places, then read the gap after the policy as its effect.11 min

In the news