ArticleslgStudy

science

Difference in differences

Difference in differences is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Difference in differences rather than just read about it. In short: Difference in differences (DiD or DD) is a quasi-experimental statistical technique used in econometrics and quantitative research in the social sciences that attempts to mimic an experimental research design using observational study data by studying the differential effect of a treatment on a "treatment group" versus a "control group" in a natural experiment. It calculates the effect of a treatment (i.e., an expla…

Difference in differences — main illustration
Difference in differences — illustration

Key takeaways

  • Difference in differences belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Difference in differences to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Difference in differences from memory before moving on to harder problems.

Reference excerpt

Difference in differences (DiD or DD) is a quasi-experimental statistical technique used in econometrics and quantitative research in the social sciences that attempts to mimic an experimental research design using observational study data by studying the differential effect of a treatment on a "treatment group" versus a "control group" in a natural experiment. It calculates the effect of a treatment (i.e., an explanatory variable or an independent variable) on an outcome (i.e., a response variable or dependent variable) by comparing the average change over time in the outcome variable for the treatment group to the average change over time for the control group. Although it is intended to mitigate the effects of extraneous factors and selection bias, depending on how the treatment group is chosen, this method may still be subject to certain biases (e.g., mean regression, reverse causality and omitted variable bias). In contrast to a time-series estimate of the treatment effect on subjects (which analyzes differences over time) or a cross-section estimate of the treatment effect (which measures the difference between treatment and control groups), the difference in differences uses panel data to measure the differences, between the treatment and control group, of the changes in the outcome variable that occur over time.

General definition

Difference in differences requires data measured from a treatment group and a control group at two or more different time periods, specifically at least one time period before "treatment" and at least one time period after "treatment". In the example pictured, the outcome in the treatment group is represented by the line P, and the outcome in the control group is represented by the line S. The outcome (dependent) variable in both groups is measured at time 1, before either group has received the treatment (i.e., the independent or explanatory variable), represented by the points P1 and S1. The treatment group then receives or experiences the treatment and both groups are again measured at time 2. Not all of the difference between the treatment and control groups at time 2 (that is, the difference between P2 and S2) can be explained as being an effect of the treatment, because the treatment group and control group did not start out at the same point at time 1. DiD, therefore, calculates the "normal" difference in the outcome variable between the two groups (the difference that would still exist if neither group experienced the treatment), represented by the dotted line Q. (Notice that the slope from P1 to Q is the same as the slope from S1 to S2.) The treatment effect is the difference between the observed outcome (P2) and the "normal" outcome (the difference between P2 and Q).

Formal definition Consider the model

yit = γs(i)+λt+δI(…)+εit where yit is the dependent variable for individual i and time t, s(i) is the group to which i belongs (i.e. the treatment or the control group), and I(…) is short-hand for the dummy variable equal to 1 when the event described in (…) is true, and 0 otherwise. In the plot of time versus Y by group, γs is the vertical intercept for the graph for s, and λt is the time trend shared by both groups according to the parallel trend assumption (see Assumptions below). δ is the treatment effect, and εit is the residual term. Consider the average of the dependent variable and dummy indicators by group and time:

ns= number of individuals in group sy‾st=1ns∑i=1nyit I(s(i) = s),γ‾s=1ns∑i=1nγs(i) I(s(i) = s) = γs,λ‾st=1ns∑i=1nλt I(s(i) = s) = λt,I‾st=1ns∑i=1nI(s(i) = treatment, t in after period) I(s(i) = s) = I(s = treatment, t in after period) = Dst,ε‾st=1ns∑i=1nεit I(s(i) = s), and suppose for simplicity that s=1,2 and t=1,2. Note that Dst is not random; it just encodes how the groups and the periods are labeled. Then

(y‾11−y‾12)−(y‾21−y‾22)=[(γ1+λ1+δD11+ε‾11)−(γ1+λ2+δD12+ε‾12)]−[(γ2+λ1+δD21+ε‾21)−(γ2+λ2+δD22+ε‾22)]=δ(D11−D12)+δ(D22−D21)+ε‾11−ε‾12+ε‾22−ε‾21. The strict exogeneity assumption then implies that

E⁡[(y‾11−y‾12)−(y‾21−y‾22)] = δ(D11−D12)+δ(D22−D21). Without loss of generality, assume that s=2 is the treatment group, and t=2 is the after period, then D22=1 and D11=D12=D21=0, giving the DiD estimator

δ̂ = (y‾11−y‾12)−(y‾21−y‾22), which can be interpreted as the treatment effect of the treatment indicated by Dst. Below it is shown how this estimator can be read as a coefficient in an ordinary least squares regression. The model described in this section is over-parametrized; to remedy that, one of the coefficients for the dummy variables can be set to 0, for example, we may set γ1=0.

Assumptions

… excerpt ends here. Continue reading the full article.

Illustrations

Difference in differences: Illustration of the parallel trend assumption
Illustration of the parallel trend assumption

Worked examples

Example 1 — a first encounter with Difference in differences

Start with the simplest possible case. Write down what Difference in differences claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Difference in differences before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Difference in differences ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Difference in differences

In research
Difference in differences appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Difference in differences in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Difference in differences is common in secondary-school and first-year university syllabi. It links to neighbouring topics Causal inference, Design of experiments, Econometric modeling, so understanding it makes those chapters shorter.
In everyday life
Look for Difference in differences outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Difference in differences” →

How to study Difference in differences in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Difference in differences means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Difference in differences out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Difference in differences in simple terms?

Difference in differences (DiD or DD) is a quasi-experimental statistical technique used in econometrics and quantitative research in the social sciences that attempts to mimic an experimental research design using observational study data by studying the differential effect of a treatment on a "tr…

Why does Difference in differences matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Difference in differences?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Difference in differences.

Tags

  • Causal inference
  • Design of experiments
  • Econometric modeling
  • Observational study
  • Regression analysis
  • Subtraction

Keep exploring