Difference in differences: Difference between revisions

Content deleted Content added
m Assumptions: remove unnecessary space
Further reading: Timothy G. Conley
 
(24 intermediate revisions by 16 users not shown)
Line 1:
{{short description|Statistical technique to use observational data for causal analysis}}
'''Difference in differences''' ('''DID'''<ref>{{cite journal |last=Abadie |first=A. |year=2005 |title=Semiparametric difference-in-differences estimators |journal=[[Review of Economic Studies]] |volume=72 |issue=1 |pages=1–19 |doi=10.1111/0034-6527.00321 |citeseerx=10.1.1.470.1475 |s2cid=8801460 }}</ref> or '''DD'''<ref name=Bertrand>{{cite journal |last1=Bertrand |first1=M. |last2=Duflo |first2=E. |author-link2=Esther Duflo |last3=Mullainathan |first3=S. |year=2004 |title=How Much Should We Trust Differences-in-Differences Estimates? |journal=[[Quarterly Journal of Economics]] |volume=119 |issue=1 |pages=249–275 |doi=10.1162/003355304772839588 |s2cid=470667 |url=http://www.nber.org/papers/w8841.pdf }}</ref>) is a [[statistics|statistical technique]] used in [[econometrics]] and [[quantitative research]] in the social sciences that attempts to mimic an [[experiment|experimental research design]] using [[observational study|observational study data]], by studying the differential effect of a treatment on a 'treatment group' versus a '[[control group]]' in a [[natural experiment]].<ref>{{cite book |last1=Angrist |first1=J. D. |last2=Pischke |first2=J. S. |year=2008 |title=Mostly Harmless Econometrics: An Empiricist's Companion |publisher=Princeton University Press |isbn=978-0-691-12034-8 |pages=227–243 |url=https://books.google.com/books?id=ztXL21Xd8v8C&pg=PA227 }}</ref> 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., [[regression to the mean|mean regression]], [[Reverse causality bias|reverse causality]] and [[omitted variable bias]]).
 
In contrast to a [[time series|time-series estimate]] of the treatment effect on subjects (which analyzes differences over time) or a [[cross-section study|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==
[[File:Illustration of Difference in Differences.png|thumb|upright=1.3]]
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 ''P''<sub>1</sub> and ''S''<sub>1</sub>. 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 ''P''<sub>2</sub> and ''S''<sub>2</sub>) 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 ''P''<sub>1</sub> to ''Q'' is the same as the slope from ''S''<sub>1</sub> to ''S''<sub>2</sub>.) The treatment effect is the difference between the observed outcome (P<sub>2</sub>) and the "normal" outcome (the difference between P<sub>2</sub> and Q).
 
==Formal definition==
Line 54:
[[File:Parallel Trend Assumption.png|right|thumb|320px| Illustration of the parallel trend assumption]]
 
All the assumptions of the [[Ordinary least squares#Assumptions|OLS model]] apply equally to DID. In addition, DID requires a '''parallel trend assumption'''. The parallel trend assumption says that <math>\lambda_2 - \lambda_1</math> are the same in both <math>s=1</math> and <math>s=2</math>. Given that the [[#Formal Definition|formal definition]] above accurately represents reality, this assumption automatically holds. However, a model with <math>\lambda_{st} ~:~ \lambda_{22} - \lambda_{21} \neq \lambda_{12} - \lambda_{11}</math> may well be more realistic. In order to increase the likelihood of the parallel trend assumption holding, a difference-in-differencedifferences approach is often combined with [[Matching (statistics)|matching]].<ref>{{cite journal |first1=Pallavi |last1=Basu |author2-link=Dylan S. Small |first2=Dylan |last2=Small |year=2020 |title=Constructing a More Closely Matched Control Group in a Difference-in-Differences Analysis: Its Effect on History Interacting with Group Bias |journal=[[Observational Studies]] |volume=6 |pages=103–130|doi=10.1353/obs.2020.0011 |s2cid=221702893 |url=https://obsstudiesmuse.orgjhu.edu/wp-contentarticle/uploads793352/2020/09/basu_small_2020-1.pdf |arxiv=2009.06935 }}</ref> This involves 'Matchingmatching' known 'treatment' units with simulated counterfactual 'control' units: characteristically equivalent units which did not receive treatment. By defining the Outcome Variable as a temporal difference (change in observed outcome between pre- and posttreatment periods), and Matchingmatching multiple units in a large sample on the basis of similar pre-treatment histories, the resulting [[Average_treatment_effect|ATE]] (i.e. the ATT: Average Treatment Effect for the Treated) provides a robust difference-in-differencedifferences estimate of treatment effects. This serves two statistical purposes: firstly, conditional on pre-treatment covariates, the parallel trends assumption is likely to hold; and secondly, this approach reduces dependence on associated ignorability assumptions necessary for valid inference.
 
As illustrated to the right, the treatment effect is the difference between the observed value of ''y'' and what the value of ''y'' would have been with parallel trends, had there been no treatment. The Achilles' heel of DID is when something other than the treatment changes in one group but not the other at the same time as the treatment, implying a violation of the parallel trend assumption.
 
To guarantee the accuracy of the DID estimate, the composition of individuals of the two groups is assumed to remain unchanged over time. When using a DID model, various issues that may compromise the results, such as [[autocorrelation]]<ref>{{cite journal |first1=Marianne |last1=Bertrand |first2=Esther |last2=Duflo | first3=Sendhil | last3=Mullainathan |year=2004 |title=How Much Should We Trust Differences-In-Differences Estimates? |journal=[[Quarterly Journal of Economics]] |volume=119 |issue=1 |pages=249–275 |doi=10.1162/003355304772839588|s2cid=470667 |url=http://www.nber.org/papers/w8841.pdf }}</ref> and [[Ashenfelter dip]]s, must be considered and dealt with.
 
==Implementation==
 
Line 90 ⟶ 91:
</math>
 
where <math>\widehat{E}(\dots \mid \dots )</math> stands for conditional averages computed on the sample, for example, <math>T=1</math> is the indicator for the after period, <math>S=0</math> is an indicator for the control group. Note that <math>\hat{\beta}_1</math> is an estimate of the counterfactual rather than the impact of the control group. The control group is often used as a proxy for the [[counterfactual]] (see, [[Synthetic control method]] for a deeper understanding of this point). Thereby, <math>\hat{\beta}_1</math> can be interpreted as the impact of both the control group and the intervention's (treatment's) counterfactual. Similarly, <math>\hat{\beta}_2</math>, due to the parallel trend assumption, is also the same differential between the treatment and control group in <math> T=1 </math>. The above descriptions should not be construed to imply the (average) effect of only the control group, for <math>\hat{\beta}_1</math>, or only the difference of the treatment and control groups in the pre-period, for <math>\hat{\beta}_2</math>. As in [[David Card|Card]] and [[Alan Krueger|Krueger]], below, a first (time) difference of the outcome variable <math>(\Delta Y_i = Y_{i,1} - Y_{i,0})</math> eliminates the need for time-trend (i.e., <math>\hat{\beta}_1</math>) to form an unbiased estimate of <math>\hat{\beta}_3</math>, implying that <math>\hat{\beta}_1</math> is not actually conditional on the treatment or control group.<ref name="David">{{cite journal |first1=David |last1=Card |first2=Alan B. |last2=Krueger |year=1994 |title=Minimum Wages and Employment: A Case Study of the Fast-Food Industry in New Jersey and Pennsylvania |journal=[[American Economic Review]] |volume=84 |issue=4 |pages=772–793 |jstor=2118030 }}</ref> Consistently, a difference among the treatment and control groups would eliminate the need for treatment differentials (i.e., <math>\hat{\beta}_2</math>) to form an unbiased estimate of <math>\hat{\beta}_3</math>. This nuance is important to understand when the user believes (weak) violations of parallel pre-trend exist or in the case of violations of the appropriate counterfactual approximation assumptions given the existence of non-common shocks or confounding events. To see the relation between this notation and the previous section, consider as above only one observation per time period for each group, then
 
: <math>
Line 109 ⟶ 110:
But this is the expression for the treatment effect that was given in the [[#Formal Definition|formal definition]] and in the above table.
 
Variants of difference-in-difference frameworks include ones for staggered implementation of treatment as well as an estimator introduced for multiple time periods and other variations by Brantly Callaway and [[Pedro H.C. Sant'Anna]].<ref>{{Cite journal |last=Callaway |first=Brantly |last2=Sant’Anna |first2=Pedro H. C. |date=2021-12-01 |title=Difference-in-Differences with multiple time periods |url=https://www.sciencedirect.com/science/article/abs/pii/S0304407620303948 |journal=Journal of Econometrics |series=Themed Issue: Treatment Effect 1 |volume=225 |issue=2 |pages=200–230 |doi=10.1016/j.jeconom.2020.12.001 |issn=0304-4076|url-access=subscription }}</ref>
==Card and Krueger (1994) example==
 
==Example==
Considered one of the most famous DID studies, the [[David Card|Card]] and [[Alan Krueger|Krueger]] article on [[minimum wage]] in [[New Jersey]], published in 1994.<ref>{{cite journal |first1=David |last1=Card |first2=Alan B. |last2=Krueger |year=1994 |title=Minimum Wages and Employment: A Case Study of the Fast-Food Industry in New Jersey and Pennsylvania |journal=[[American Economic Review]] |volume=84 |issue=4 |pages=772–793 |jstor=2118030 }}</ref> Card and Krueger compared [[Unemployment|employment]] in the [[fast food]] sector in New Jersey and in [[Pennsylvania]], in February 1992 and in November 1992, after New Jersey's minimum wage rose from $4.25 to $5.05 in April 1992. Observing a change in employment in New Jersey only, before and after the treatment, would fail to control for [[Omitted-variable bias|omitted variables]] such as weather and macroeconomic conditions of the region. By including Pennsylvania as a control in a difference-in-differences model, any bias caused by variables common to New Jersey and Pennsylvania is implicitly controlled for, even when these variables are unobserved. Assuming that New Jersey and Pennsylvania have parallel trends over time, Pennsylvania's change in employment can be interpreted as the change New Jersey would have experienced, had they not increased the minimum wage, and vice versa. The evidence suggested that the increased minimum wage did not induce a decrease in employment in New Jersey, contrary to what some economic theory would suggest. The table below shows Card & Krueger's estimates of the treatment effect on employment, measured as [[Full-time equivalent|FTEs (or full-time equivalents)]]. Card and Krueger estimate that the $0.80 minimum wage increase in New Jersey led to a 2.75 FTE increase in employment.
 
Considered one of the most famous DID studies, theThe [[David Card|Card]] and [[Alan Krueger|Krueger]] article on [[minimum wage]] in [[New Jersey]], published in 1994.,<ref>{{cite journal |first1name="David"/> |last1=Cardis |first2=Alanconsidered B.one |last2=Kruegerof |year=1994the |title=Minimummost Wagesfamous andDID Employment:studies; ACard Casewas Studylater ofawarded the Fast-Food2021 Industry[[Nobel inMemorial NewPrize Jersey and Pennsylvania |journal=[[Americanin Economic ReviewSciences]] |volume=84in |issue=4part |pages=772–793for |jstor=2118030this }}</ref>and related work. Card and Krueger compared [[Unemployment|employment]] in the [[fast food]] sector in New Jersey and in [[Pennsylvania]], in February 1992 and in November 1992, after New Jersey's minimum wage rose from $4.25 to $5.05 in April 1992. Observing a change in employment in New Jersey only, before and after the treatment, would fail to control for [[Omitted-variable bias|omitted variables]] such as weather and macroeconomic conditions of the region. By including Pennsylvania as a control in a difference-in-differences model, any bias caused by variables common to New Jersey and Pennsylvania is implicitly controlled for, even when these variables are unobserved. Assuming that New Jersey and Pennsylvania have parallel trends over time, Pennsylvania's change in employment can be interpreted as the change New Jersey would have experienced, had they not increased the minimum wage, and vice versa. The evidence suggested that the increased minimum wage did not induce a decrease in employment in New Jersey, contrary to what some economic theory would suggest. The table below shows Card & Krueger's estimates of the treatment effect on employment, measured as [[Full-time equivalent|FTEs (or full-time equivalents)]]. Card and Krueger estimate that the $0.80 minimum wage increase in New Jersey led to aan average 2.75 FTE increase in employment per store.
 
{| class="wikitable"
Line 123 ⟶ 126:
| '''Change''' || 0.59 || −2.16 || 2.75
|}
 
A software example application of this research is found on the [[Stata]]'s command -diff- <ref name="StataDiff">{{cite journal |first1=Juan M.|last1=Villa |year=2016|title=diff: Simplifying the estimation of difference-in-differences treatment effects |journal=The Stata Journal |volume=16 |issue=1 |pages=52–71|doi=10.1177/1536867X1601600108 |s2cid=124464636 |doi-access=free }}</ref> authored by [[:es:Juan Miguel Villa|Juan Miguel Villa]].
 
==See also==
Line 134 ⟶ 139:
==Further reading==
*{{cite book |last1=Angrist |first1=J. D. |last2=Pischke |first2=J. S. |year=2008 |title=Mostly Harmless Econometrics: An Empiricist's Companion |publisher=Princeton University Press |isbn=978-0-691-12034-8 |pages=227–243 |url=https://books.google.com/books?id=ztXL21Xd8v8C&pg=PA227 }}
*Andrew Baker, Brantly Callaway, Scott Cunningham, Andrew Goodman-Bacon and Pedro H. C. Sant'Anna. 2025. "[[arxiv:2503.13323|Difference-in-Differences Designs: A Practitioner’s Guide.]]" ''Journal of Economic Literature''.
*{{cite book | first1 = Arthur C. |last1=Cameron |first2=Pravin K. |last2=Trivedi |year=2005 |title=Microeconometrics: Methods and Applications |publisher=Cambridge university press |isbn=9780521848053 |doi=10.1017/CBO9780511811241 |pages=768–772 |urls2cid=https://api.semanticscholar.org/CorpusID:120313863 }}
*{{cite journal |last1=Imbens |first1=Guido W. |first2=Jeffrey M. |last2=Wooldridge |year=2009 |title=Recent Developments in the Econometrics of Program Evaluation |journal=[[Journal of Economic Literature]] |volume=47 |issue=1 |pages=5–86 |doi=10.1257/jel.47.1.5 |url=http://nrs.harvard.edu/urn-3:HUL.InstRepos:3043416 }}
*{{cite journal |first1=Jon |last1=Bakija |first2=Bradley |last2=Heim |title=How Does Charitable Giving Respond to Incentives and Income? Dynamic Panel Estimates Accounting for Predictable Changes in Taxation |journal=NBER Working Paper No. 14237 |date=August 2008 |doi=10.3386/w14237 |doi-access=free }}
*{{cite journal |first1=T. |last1=Conley |first2=C. |authorlink1=Timothy G. Conley|last2=Taber |title=Inference with 'Difference in Differences' with a Small Number of Policy Changes |journal=NBER Technical Working Paper No. 312 |date=July 2005 |doi=10.3386/t0312 |doi-access=free }}
 
==External links==