← Methods The difference-in-differences recipe →

Difference-in-differences

498
packages in the design · 497 papers
449
of them have a model that shows the design itself — the models read below
262
run a dedicated difference-in-differences estimator (3,446 estimations)
How the design is counted — the same count on the recipe, outcomes and methods pages
  • The universe is every replication package our extractors have read (code_model_design) that is linked to a live paper by a confirmed link; the field is the linked paper's.
  • A package is in a design when (a) our extractor found the design's identification pattern on a line of code it runs (not a path, a folder macro, an export or an install line), or (b) it runs a model of the design's own estimator family. An ivreg2 / ivreghdfe call with no (endog = z) group counts for neither: it is OLS with robust or HAC errors, not IV.
  • Panel fixed effects is the rest: a fixed-effects estimation and none of the other designs. A package can be in several designs (not panel FE).
  • A model is an estimation OF the design only when the model itself carries the design's signature; the recipe's estimation choices, the outcomes, the instruments and every example are read from those models.
  • This design's signature in a model: a DiD estimator (csdid, did_imputation, ...), a treatment × post interaction, a regressor whose name is one (treat_post, CaptiveXAfter, did), or a treatment / post indicator under two-way fixed effects.
  • 479 packages declare the design in code; 262 are in it by their estimator (a package can be both).

Adoption over time — the dedicated estimator

2021: 4 of 392 packages (1.0%) 2022: 8 of 775 packages (1.0%) 2023: 24 of 909 packages (2.6%) 2024: 60 of 1,136 packages (5.3%) 2025: 77 of 1,322 packages (5.8%) 2025 2026: 89 of 1,459 packages (6.1%)

Share of each publication year's packages with parsed models that run this estimator at least once (hover for counts). Grey years have fewer than 10 packages and are not a trend; package coverage is thin before ~2010, when journal data policies began.

Validation practice

Of the 498 packages in the design, how many run each standard check (read from the code; the same checks and numbers as the recipe). A check run under a macro or in a file we could not read is missed, so these are lower bounds. Greyed: fewer than 10 packages.

pre-trend test (leads / parallel trends)
27% · 132
event-time (lead/lag) dummies
5% · 27
event-study plot
17% · 83
heterogeneity-robust estimator (csdid, did_imputation, did_multiplegt, ...)
52% · 257
HonestDiD sensitivity bounds
7% · 35
multiple-testing correction (FDR, Romano-Wolf, ...)
5% · 23

What it is used to study

The dependent variables of this design's estimations, read from the model roles we read from the code. Of the 498 packages in the design, 449 have a model that shows the design itself, and 429 of those have a readable outcome (11,572 models; for 159 packages some outcome is read only through a loop's expansion). Shares are of those 429 packages, one count per package; greyed rows rest on fewer than 10. An outcome that is a taxonomy measure's variable in the same package is shown as the measure; other names are grouped by what they name. Compare every design →

How this is counted
  • The unit is the package: a package counts once for an outcome, measure or instrument type however many of its models carry it; the model count is shown second.
  • A design's packages are the ONE design membership every page shows (identification fact on a line of code, or the design's own estimator). Its models are the ones that carry the design's signature in the model itself — a DiD estimator or a treatment × post term, event-time dummies or an abnormal-return outcome, an excluded instrument, an RD estimator or a bandwidth around a cutoff, a matching estimator or matched weights. A package with none of those models is counted in the design but has no outcome here.
  • Roles are read from each model's literal row. Only where a literal role still holds a macro (`y', $dep) are the loop-expanded rows written on the same line read for that role; an expanded row whose literal row is resolved adds nothing, and an unresolved role with no expansion is dropped.
  • An outcome is a taxonomy measure when the dependent variable is that measure's variable in the same package; otherwise it is grouped by its name (a word list, field-aware for short names like car, q, ret); otherwise it is shown as the bare variable.
  • Instruments are the EXCLUDED ones: a term also among the model's regressors is an included control. Types are read from the name (and L. / lag for lagged values). Where the name says nothing (`z`, `shock`, `iv1`), the instrument is traced to the statement in the package that builds it, up to three statements back, and typed by that statement's shape — (total − own)/(n − 1) a leave-out mean, L.x or x[_n-1] a lag, predict after a model a predicted value, a by-group sum of share × shock a shift-share, geodist a distance — or by the name of the one variable it copies or transforms. Products, thresholds and aggregates of other variables are not read, and an instrument nothing reliable types stays untyped. Each such example shows the statement, linked to its line.

Finance — 70 of 80 packages have a readable outcome

Economics — 341 of 393 packages have a readable outcome

Outcomes that are taxonomy measures (all fields: the package computes the measure and estimates it as the outcome)

Commonest outcome names no group reads (all fields, packages): coverage (3), other (3), resid (3), total (3), alcohol (2), count (2), diff (2), disab (2), drugs (2), light (2), lny (2), logposted (2).

Commands (of the 262 packages running the dedicated estimator)

  • did_imputation91
  • eventstudyinteract86
  • csdid75
  • did_multiplegt71
  • att_gt26
  • xtdidregress5
  • drdid4
  • did2s1

Inference (of the 262 packages running the dedicated estimator)

  • cluster187
  • default117
  • robust4
  • wild_bootstrap1

Clustering variables (of the 262 packages running the dedicated estimator)

  • id10
  • i9
  • fips7
  • statefips7
  • state6
  • statefip5
  • cityid3
  • state_fips3

Absorbed fixed effects (of the 262 packages running the dedicated estimator)

  • i.year43
  • id8
  • t8
  • i7
  • date3
  • i.gvkey3
  • i.qdate3
  • i.statefip3

Foundational works

What the papers whose code runs this estimator cite most (share of those papers citing each).

Recent examples, straight from the code

One model per package, from the most recent papers — each one shows the design itself (why is given beside it).

ESG Shocks in Global Supply Chains Review of Financial Studies 2026 · BSZ_Tables_Mainpaper.do:497 · pkg 266 DiD estimator
did_imputation  trade4 i t Ei , fe(pair indyear case) controls($x period_2 period_1 period0 period1 period2 period3)  autosample cluster(casesupp) tol(0.1)
As we read it — macros filled in / loop expanded (an interpretation, not the file's text):
did_imputation trade4 i t Ei , fe(pair indyear case) controls(size mtb lev rd invest cash period_2 period_1 period0 period1 period2 period3) autosample cluster(casesupp) tol(0.1)
The Impact of Carcinogenic Risk Exposure on Housing Values: Estimates from Chemical Reclassifications Review of Financial Studies 2026 · 02_plant_sales_employment.do:167 · pkg 278 DiD term by name
eststo: reghdfe lnemp treated post post_treated if  inrange(_t_bc,-`window',`window'), absorb($fe) vce(clus $clus)
As we read it — macros filled in / loop expanded (an interpretation, not the file's text):
eststo: reghdfe lnemp treated post post_treated if inrange(_t_bc,-`window',`window'), absorb(plantid statecode#_t_bc naics#_t_bc) vce(clus plantid)
Stakeholder Orientation, Product Market Competition, and the Cost of Equity Review of Corporate Finance Studies 2026 · code_for_tables.do:655 · pkg 7269 DiD estimator
eventstudyinteract rgls scs_high_hhi scs_low_hhi , cohort(list_scs) control_cohort(never_treat) covariates(ubeta idvol logmv mb mlev fbias sgrw ixrgls) absorb(i.gvkey i.year) vce(cluster incorpn)
Competition and Certification: Theory and Evidence from the Audit Market Review of Corporate Finance Studies 2026 · RCFS_Replication.do:126 · pkg 7319 DiD term by name
eststo: reghdfe lspread treat_post treat post                                                                                                             , abs(ind_yr bank_yr msa) cluster(msa) keepsing
Why Doesn’t the United States Have National Health Insurance? The Political Role of the American Medical Association Quarterly Journal of Economics 2026 · c_components_coef_rep.do:30 · pkg 7432 treatment indicator under two-way fixed effects
reghdfe share_enroll  $design_controls_state c.std_add_exp post std_add_exp_post, a(state_fips yr) cluster(state_fips)
As we read it — macros filled in / loop expanded (an interpretation, not the file's text):
reghdfe share_enroll personal_income union_st c.std_add_exp post std_add_exp_post, a(state_fips yr) cluster(state_fips)
Trust and Innovation Within the Firm: Evidence from Matched CEO-Firm Data Quarterly Journal of Economics 2026 · Code_Trust_Innovation_Appendix_tables_figures.do:703 · pkg 7584 DiD estimator
eventstudyinteract ash_f1allpat postchange, cohort(cohort) control_cohort(notmoretrust) ///
    covariates(${firm} ${ceo} postchange) absorb(eventid year) vce(cluster ${cluster})
As we read it — macros filled in / loop expanded (an interpretation, not the file's text):
eventstudyinteract ash_f1allpat postchange, cohort(cohort) control_cohort(notmoretrust) covariates(firmage firmage2 gender age age2 yrinco i.education postchange) absorb(eventid year) vce(cluster eventid)
The Effect of Education Policy on Crime: An Intergenerational Perspective Journal of Political Economy 2026 · code_1.MONA_analysis_TableA15.do:78 · pkg 7857 DiD estimator
csdid `v'1529 [weight=pop], time(cohort_f) gvar(xxx) cluster(kommun60_bf) agg(simple) notyet
Why Is Workplace Sexual Harassment Underreported? The Value of Outside Options amid the Threat of Retaliation American Economic Review 2026 · 12 main volume analysis.do:1857 · pkg 11708 DiD estimator
did_imputation log_c_any st mdate treated if Sexual_Harassment_indicator==1 & mdate>=582, autosample cluster(st) fe(st mdate)
Sweeping up Gangs: The Effects of Tough-on-Crime Policies from a Network Approach American Economic Journal: Economic Policy 2026 · 5.regressionanalysis.do:186 · pkg 11714 DiD estimator
eventstudyinteract Y F*event L*event  if arrested==1 & t!=219  , vce(cluster i) absorb(i t i.yob#c.t i.female#c.t i.idnac#c.t) cohort(ei) control_cohort(lastcohort)
Banking Networks and Economic Growth: From Idiosyncratic Shocks to Aggregate Fluctuations American Economic Journal: Macroeconomics 2026 · 2. Main_Tables.do:72 · pkg 11744 treatment indicator under two-way fixed effects
qui eststo m3: reghdfe w_g_gdp post_ind_tau_1 ind_tau_1 post, a(region_gdp#year region_tau#year) cl(state_1 state_2) nocons
Difference-in-Differences Designs: A Practitioner’s Guide Journal of Economic Literature 2026 · 2_2x2.R:548 · pkg 11745 DiD estimator
atts <- att_gt(
  yname = "crude_rate_20_64",
  tname = "year",
  idname = "county_code",
  gname = "treat_year",
  xformla =  as.formula(paste("~", paste(covs, collapse = "+"))),
  data = data_cs,
  panel = TRUE, …
Survivors’ Mental Health and the Protective Role of Income Stability American Economic Review: Insights 2026 · figure_3b.do:68 · pkg 11753 treatment × time interaction
ivreghdfe $y i.post i.post#i.treat (endogen2  = instrument3 instrument32 ins4) tp_female tp_child_b18_d tp_child_a18_d tp_child_missing tp_ln_inc $controls1 if inrange(ref_time,-1,0) & h_koen==1, absorb(s_pnr) cluster(s_pnr)
As we read it — macros filled in / loop expanded (an interpretation, not the file's text):
ivreghdfe h_psycho i.post i.post#i.treat (endogen2 = instrument3 instrument32 ins4) tp_female tp_child_b18_d tp_child_a18_d tp_child_missing tp_ln_inc i.year c.h_alder c.h_alder_2 if inrange(ref_time,-1,0) & h_koen==1, absorb(s_pnr) cluster(s_pnr)