Difference in differences
Intermediate
What you need first. Nothing else on this path comes first. This page is part of Statistical inference.
In study design, difference in differences are a treated group’s before-and-after change minus the same change in a comparison group. Sometimes the treated and the untreated already differ, and the difference was visible before anyone was treated. Difference in differences subtracts that earlier gap from the later gap, and treats what remains as the effect in the treated.[1]
Difference in differences
| Fact | Value |
|---|---|
| Topic | Statistical inference |
| Listed on | Statistical inference |
| Worked example | 1 |
Motivating example
Aspirin use and blood pressure share causes, such as a history of heart disease, that were not measured. Standardisation cannot block that path. Blood pressure was also recorded before aspirin was available. That earlier measurement cannot have been caused by the later aspirin, and it can still show how large the confounding gap was. Removing that gap from the later contrast is the difference-in-differences step.[1]
Intuition
Write two changes: how the outcome moved in the treated group, and how it moved in the comparison group. If the comparison group is a guide to the change the treated group would have experienced anyway, the extra change in the treated group is the effect. Equivalently, subtract the pre-treatment gap between the groups from the post-treatment gap.[1]
Definition
Let be treatment, the outcome after treatment is available, and a pre-treatment measurement of the outcome, a negative outcome control. The effect of treatment on the treated, on the additive scale, is identified by
when the additive confounding is the same for and for the untreated potential outcome . That common confounding is the assumption of additive equi-confounding.[1]
The pre-treatment contrast is not a causal effect of on . It is a measure of confounding, because does not cause a measurement taken before existed.[1]
Statistical use
The same number can be computed as a difference of changes. The change in the treated group is . The change in the comparison group is . Subtracting those changes reproduces the display above.[1]
Difference in differences is used when conditional exchangeability given the measured covariates is not believed, and a pre-treatment outcome is available to stand in for the unmeasured common causes. It sits with instrumental-variable estimation as a method that trades one unverifiable assumption for another. The target it identifies, under additive equi-confounding, is the average effect in the treated, not automatically the average effect in the whole population. Measured covariates can be adjusted for at the same time, by parametric or semiparametric versions of the same contrast.[1]
A randomised experiment assigns the treatment and is the design built for a causal reading. Difference in differences does not replace that assignment. It is an observational correction. Observational studies are generally sufficient to show associations. A causal conclusion from them needs an assumption that the data alone do not check.[2] [1]
Worked example
Mean blood pressure, in millimetres of mercury, is 150 before and 140 after among aspirin users, and 148 before and 146 after among non-users. The post-treatment gap is . The pre-treatment gap is . The difference in differences is . As changes: users fall by , non-users fall by , and millimetres, with the sign recording a larger fall in the treated group. The effect in the treated is if additive equi-confounding holds.[1]
Your turn. The non-users’ later mean is 144 instead of 146, and nothing else changes. What is the difference in differences?
The post-treatment gap is . The pre-treatment gap is still . The difference in differences is .
Common misconceptions
A larger change in the treated group is not yet an effect. It is an effect in the treated only if the comparison group’s change equals the change the treated group would have had without treatment. That is the equi-confounding assumption, and it is not guaranteed by having two time points.[1]
The pre-treatment gap is not evidence that the treatment was already working. The treatment was not yet there. The gap is confounding, visible early.[1]
Additive equi-confounding can fail when the groups are diverging for reasons that change over time, or when and are not the same measurement on a common scale. The method needs both waves on that scale. The identifying assumption cannot be verified from the same contrast that it corrects.[1]
Connections
The target is a version of the average treatment effect, restricted to the treated. Causality here is the counterfactual change . An instrumental variable is the other standard route when a common cause is unmeasured. A natural experiment is often analysed with this contrast when a policy arrives in one place and not another. The comparison series plays the role of a control group that was not assigned by the investigator.[1] [2]
The pre-treatment outcome as a negative control, and the subtraction of the two gaps, is the construction known in economics as difference in differences. It remains a restrictive special case of negative-outcome-control methods, which can sometimes put the two measurements on different scales.[1]
Check yourself
Try these questions before opening an answer.
The early gap
The pre-treatment gap between the groups is large. Why is that gap not evidence that the treatment was already working?
The treatment was not yet available, so it cannot have caused the earlier measurement. The gap measures confounding.
Diverging groups
The groups are diverging for reasons that change between the two waves. Which identifying assumption does that break?
Additive equi-confounding. The comparison group’s change is then not the change the treated group would have had without treatment.
See also
Line chart · Apriori algorithm · Asymptotic analysis · Average treatment effect · Base rate · Bayesian inference · Bayesian model · Bayesian probability
References
- ^ a b c d e f g h i j k l m n a. (Ch. 7, Technical Point 7.3, p. 106) b. (Ch. 7, Technical Point 7.3, p. 106) c. (Ch. 7, Technical Point 7.3, p. 106) d. (Ch. 7, Technical Point 7.3, p. 106) e. (Ch. 7, Technical Point 7.3, p. 106) f. (Ch. 7, Technical Point 7.3, p. 106) g. (Ch. 7, §7.6, pp. 104–106) h. (Ch. 7, §7.6, p. 104) i. (Ch. 7, Technical Point 7.3, p. 106) j. (Ch. 7, Technical Point 7.3, p. 106) k. (Ch. 7, Technical Point 7.3, p. 106) l. (Ch. 7, Technical Point 7.3, p. 106; §7.6, p. 104) m. (Ch. 7, §7.6, pp. 104–106) n. (Ch. 7, Technical Point 7.3, p. 106) Hernán, M. A. & Robins, J. M. (2020). Causal Inference: What If. Chapman & Hall/CRC. https://miguelhernan.org/s/hernanrobins_WhatIf_19aug26.pdf
- ^ a b a. (Ch. 1, §1.2.5; §1.4) b. (Ch. 1, §1.4) Diez, D. M., Çetinkaya-Rundel, M. & Barr, C. D. (2019). OpenIntro Statistics (4th ed.). OpenIntro. https://www.openintro.org/book/os/
Cite this page
StatWiki (2026). "Difference in differences." StatWiki. Last updated 2 December 2026. https://www.statwiki.io/articles/difference-in-differences.html
@misc{statwiki_difference_in_differences,
author = {{StatWiki}},
title = {{Difference in differences}},
year = {2026},
url = {https://www.statwiki.io/articles/difference-in-differences.html},
urldate = {2026-12-02},
note = {StatWiki, last updated 2 December 2026}
}