Skip to content

Commit 59fa761

Browse files
igerberclaude
andcommitted
docs: add JOSS paper (paper.md) and bibliography (paper.bib)
JOSS submission for diff-diff: 16 estimators, survey-weighted inference, R validation to machine precision, and practitioner tooling under a unified scikit-learn-style API. 19 BibTeX entries sourced from docs/methodology/REGISTRY.md. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 8b03661 commit 59fa761

2 files changed

Lines changed: 287 additions & 0 deletions

File tree

‎paper.bib‎

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
@article{Callaway2021,
2+
author = {Callaway, Brantly and Sant'Anna, Pedro H. C.},
3+
title = {Difference-in-Differences with Multiple Time Periods},
4+
journal = {Journal of Econometrics},
5+
volume = {225},
6+
number = {2},
7+
pages = {200--230},
8+
year = {2021},
9+
doi = {10.1016/j.jeconom.2020.12.001}
10+
}
11+
12+
@article{Sun2021,
13+
author = {Sun, Liyang and Abraham, Sarah},
14+
title = {Estimating Dynamic Treatment Effects in Event Studies with Heterogeneous Treatment Effects},
15+
journal = {Journal of Econometrics},
16+
volume = {225},
17+
number = {2},
18+
pages = {175--199},
19+
year = {2021},
20+
doi = {10.1016/j.jeconom.2020.09.006}
21+
}
22+
23+
@article{Borusyak2024,
24+
author = {Borusyak, Kirill and Jaravel, Xavier and Spiess, Jann},
25+
title = {Revisiting Event-Study Designs: Robust and Efficient Estimation},
26+
journal = {Review of Economic Studies},
27+
volume = {91},
28+
number = {6},
29+
pages = {3253--3285},
30+
year = {2024},
31+
doi = {10.1093/restud/rdae007}
32+
}
33+
34+
@misc{Gardner2022,
35+
author = {Gardner, John},
36+
title = {Two-Stage Differences in Differences},
37+
year = {2022},
38+
eprint = {2207.05943},
39+
archiveprefix = {arXiv},
40+
primaryclass = {econ.EM}
41+
}
42+
43+
@article{Arkhangelsky2021,
44+
author = {Arkhangelsky, Dmitry and Athey, Susan and Hirshberg, David A. and Imbens, Guido W. and Wager, Stefan},
45+
title = {Synthetic Difference-in-Differences},
46+
journal = {American Economic Review},
47+
volume = {111},
48+
number = {12},
49+
pages = {4088--4118},
50+
year = {2021},
51+
doi = {10.1257/aer.20190159}
52+
}
53+
54+
@article{Rambachan2023,
55+
author = {Rambachan, Ashesh and Roth, Jonathan},
56+
title = {A More Credible Approach to Parallel Trends},
57+
journal = {Review of Economic Studies},
58+
volume = {90},
59+
number = {5},
60+
pages = {2555--2591},
61+
year = {2023},
62+
doi = {10.1093/restud/rdad018}
63+
}
64+
65+
@article{Roth2022,
66+
author = {Roth, Jonathan},
67+
title = {Pretest with Caution: Event-Study Estimates after Testing for Parallel Trends},
68+
journal = {American Economic Review: Insights},
69+
volume = {4},
70+
number = {3},
71+
pages = {305--322},
72+
year = {2022},
73+
doi = {10.1257/aeri.20210236}
74+
}
75+
76+
@article{GoodmanBacon2021,
77+
author = {Goodman-Bacon, Andrew},
78+
title = {Difference-in-Differences with Variation in Treatment Timing},
79+
journal = {Journal of Econometrics},
80+
volume = {225},
81+
number = {2},
82+
pages = {254--277},
83+
year = {2021},
84+
doi = {10.1016/j.jeconom.2021.03.014}
85+
}
86+
87+
@article{deChaisemartin2020,
88+
author = {{de Chaisemartin}, Cl\'{e}ment and D'Haultf{\oe}uille, Xavier},
89+
title = {Two-Way Fixed Effects Estimators with Heterogeneous Treatment Effects},
90+
journal = {American Economic Review},
91+
volume = {110},
92+
number = {9},
93+
pages = {2964--2996},
94+
year = {2020},
95+
doi = {10.1257/aer.20181169}
96+
}
97+
98+
@article{Wooldridge2023,
99+
author = {Wooldridge, Jeffrey M.},
100+
title = {Simple Approaches to Nonlinear Difference-in-Differences with Panel Data},
101+
journal = {The Econometrics Journal},
102+
volume = {26},
103+
number = {3},
104+
pages = {C31--C66},
105+
year = {2023},
106+
doi = {10.1093/ectj/utad016}
107+
}
108+
109+
@techreport{Wing2024,
110+
author = {Wing, Coady and Freedman, Seth M. and Hollingsworth, Alex},
111+
title = {Stacked Difference-in-Differences},
112+
institution = {National Bureau of Economic Research},
113+
type = {Working Paper},
114+
number = {32054},
115+
year = {2024},
116+
url = {https://www.nber.org/papers/w32054}
117+
}
118+
119+
@techreport{Callaway2024,
120+
author = {Callaway, Brantly and Goodman-Bacon, Andrew and Sant'Anna, Pedro H. C.},
121+
title = {Difference-in-Differences with a Continuous Treatment},
122+
institution = {National Bureau of Economic Research},
123+
type = {Working Paper},
124+
number = {32117},
125+
year = {2024}
126+
}
127+
128+
@misc{Chen2025,
129+
author = {Chen, Xun and Sant'Anna, Pedro H. C. and Xie, Haitian},
130+
title = {Efficient Difference-in-Differences and Event Study Estimators},
131+
year = {2025},
132+
note = {Working paper}
133+
}
134+
135+
@misc{Athey2025,
136+
author = {Athey, Susan and Imbens, Guido W. and Qu, Zhaonan and Viviano, Davide},
137+
title = {Triply Robust Panel Estimators},
138+
year = {2025},
139+
eprint = {2508.21536},
140+
archiveprefix = {arXiv},
141+
primaryclass = {econ.EM}
142+
}
143+
144+
@misc{OrtizVillavicencio2025,
145+
author = {Ortiz-Villavicencio, Marco and Sant'Anna, Pedro H. C.},
146+
title = {Better Understanding Triple Differences Estimators},
147+
year = {2025},
148+
eprint = {2505.09942},
149+
archiveprefix = {arXiv},
150+
primaryclass = {econ.EM}
151+
}
152+
153+
@article{Roth2023,
154+
author = {Roth, Jonathan and Sant'Anna, Pedro H. C. and Bilinski, Alyssa and Poe, John},
155+
title = {What's Trending in Difference-in-Differences? {A} Synthesis of the Recent Econometrics Literature},
156+
journal = {Journal of Econometrics},
157+
volume = {235},
158+
number = {2},
159+
pages = {2218--2244},
160+
year = {2023},
161+
doi = {10.1016/j.jeconom.2023.03.008}
162+
}
163+
164+
@misc{Baker2025,
165+
author = {Baker, Andrew C. and Larcker, David F. and McClure, Charles G. and Saraph, Durgesh and Watts, Edward M.},
166+
title = {Difference-in-Differences Designs: A Practitioner's Guide},
167+
year = {2025},
168+
eprint = {2503.13323},
169+
archiveprefix = {arXiv},
170+
primaryclass = {econ.EM}
171+
}
172+
173+
@article{Lumley2004,
174+
author = {Lumley, Thomas},
175+
title = {Analysis of Complex Survey Samples},
176+
journal = {Journal of Statistical Software},
177+
volume = {9},
178+
number = {8},
179+
pages = {1--19},
180+
year = {2004},
181+
doi = {10.18637/jss.v009.i08}
182+
}
183+
184+
@manual{Berge2018,
185+
author = {Berg\'{e}, Laurent},
186+
title = {fixest: Fast Fixed-Effects Estimations},
187+
year = {2018},
188+
note = {R package},
189+
url = {https://CRAN.R-project.org/package=fixest}
190+
}

‎paper.md‎

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
---
2+
title: "diff-diff: Comprehensive Difference-in-Differences Causal Inference for Python"
3+
tags:
4+
- difference-in-differences
5+
- causal-inference
6+
- econometrics
7+
- Python
8+
- treatment-effects
9+
- survey-data
10+
authors:
11+
- name: Isaac Gerber
12+
orcid: 0009-0009-3275-5591
13+
affiliation: 1
14+
affiliations:
15+
- name: Independent Researcher
16+
index: 1
17+
date: 12 April 2026
18+
bibliography: paper.bib
19+
---
20+
21+
# Summary
22+
23+
`diff-diff` is a Python library for Difference-in-Differences (DiD) causal inference
24+
analysis. It provides 16 estimators covering the full modern DiD toolkit - from classic
25+
two-group/two-period designs through heterogeneity-robust staggered adoption methods,
26+
synthetic control hybrids, and sensitivity analysis - under a consistent scikit-learn-style
27+
API. All estimators accept an optional `SurveyDesign` object for design-based variance
28+
estimation with complex survey data, a capability absent from existing DiD software in any
29+
language. Point estimates and standard errors are validated against established R packages
30+
to machine precision.
31+
32+
# Statement of Need
33+
34+
Difference-in-differences is the most widely used quasi-experimental research design in
35+
applied economics and the social sciences. Since 2018, a wave of methodological advances
36+
has addressed fundamental limitations of the conventional two-way fixed effects (TWFE)
37+
estimator under staggered treatment adoption and heterogeneous effects [@Roth2023]. These
38+
modern methods - including Callaway and Sant'Anna [-@Callaway2021], Sun and Abraham
39+
[-@Sun2021], Borusyak, Jaravel, and Spiess [-@Borusyak2024], and others - are now standard
40+
practice in applied work.
41+
42+
The R ecosystem provides mature implementations across several packages: `did`
43+
[@Callaway2021], `fixest` [@Berge2018], `synthdid` [@Arkhangelsky2021], and `HonestDiD`
44+
[@Rambachan2023]. Stata offers `csdid` and `didregress`. Python, however, lacks a unified
45+
DiD library. Practitioners working in Python-based data science workflows - increasingly
46+
common in industry settings for marketing measurement, product experimentation, and policy
47+
evaluation - must either context-switch to R, reimplement methods from scratch, or rely on
48+
partial implementations scattered across unrelated packages.
49+
50+
`diff-diff` fills this gap by providing a single-import library that covers 16 estimators
51+
with a consistent API, survey-weighted inference, and numerical validation against R to
52+
machine precision. It targets both applied researchers who need rigorous econometric methods
53+
and data science practitioners who need accessible causal inference tools integrated into
54+
Python workflows.
55+
56+
# Key Features
57+
58+
**Breadth of methods.** `diff-diff` implements 16 estimators organized across the modern
59+
DiD taxonomy: classic DiD and TWFE; heterogeneity-robust staggered estimators including
60+
Callaway-Sant'Anna [@Callaway2021], Sun-Abraham [@Sun2021], imputation
61+
[@Borusyak2024], two-stage [@Gardner2022], stacked [@Wing2024], and efficient
62+
[@Chen2025] approaches; extended designs including synthetic DiD [@Arkhangelsky2021],
63+
triple difference [@OrtizVillavicencio2025], continuous treatment [@Callaway2024],
64+
nonlinear ETWFE [@Wooldridge2023], and triply robust panel estimation [@Athey2025];
65+
reversible-treatment DiD for non-absorbing interventions [@deChaisemartin2020]; and
66+
diagnostics including Goodman-Bacon decomposition [@GoodmanBacon2021], Honest DiD
67+
sensitivity analysis [@Rambachan2023], and pre-trends power analysis [@Roth2022]. All
68+
estimators share a consistent `fit()` interface with `get_params()`/`set_params()` for
69+
configuration, R-style formula support, and rich results objects with `summary()` output.
70+
An optional Rust backend via PyO3 accelerates compute-intensive operations.
71+
72+
**Survey-weighted inference.** A `SurveyDesign` class supports stratification, primary
73+
sampling units, finite population corrections, and probability weights. Variance estimation
74+
includes Taylor series linearization, five replicate weight methods (BRR, Fay's BRR, JK1,
75+
JKn, SDR), and survey-aware bootstrap. Survey variance is validated against R's `survey`
76+
package [@Lumley2004] on three federal datasets (NHANES, RECS, API) to machine precision
77+
(differences < 1e-10). No other DiD package in any language provides integrated survey
78+
support.
79+
80+
**Validation against R.** Point estimates match the R `did`, `synthdid`, and `fixest`
81+
packages to machine precision (differences < 1e-10). Standard errors match exactly for
82+
core estimators including Callaway-Sant'Anna and basic DiD. Validation includes the
83+
canonical MPDTA minimum-wage dataset from Callaway and Sant'Anna [-@Callaway2021].
84+
85+
**Practitioner tooling.** Beyond estimation, `diff-diff` includes a practitioner decision
86+
tree for estimator selection, an 8-step diagnostic workflow based on Baker et al.
87+
[-@Baker2025], AI agent integration with structured next-steps guidance, and microdata
88+
aggregation utilities for converting individual-level survey responses into
89+
geographic-period panels suitable for DiD analysis.
90+
91+
# Acknowledgments
92+
93+
Wenli Xu (Faculty of Finance, City University of Macau) implemented the WooldridgeDiD
94+
(ETWFE) estimator, including saturated OLS, logit, and Poisson QMLE paths with ASF-based
95+
ATT and delta-method standard errors. Development was assisted by Claude Code (Anthropic).
96+
97+
# References

0 commit comments

Comments
 (0)