Difference-in-Differences (DiD) Resources
Resources for Causal Panel Analysis
Welcome!
This repository is a collection of resources on Difference-in-Differences (DiD) packages in R and Python (and Julia coming soon). For a more in-depth overview of the DiD design and estimators, see this page.
Estimator | Brief Description | R | Python |
---|---|---|---|
two-way fixed effects (twfe) | Standard estimator for DiD. Can be biased with staggered treatment or non-absorbing treatment. |
fixest bacondecomp |
pyfixest |
interaction-weighted (iw) | Sun and Abraham (2020). Matching and reweighting regression estimator for staggered treatment. |
fixest |
– |
doubly-robust (dr) | Callaway and Sant’Anna (2021). Matching and reweighting semi-parametric estimator for staggered treatment. |
did |
csdid |
inverse probability weighting (ipw) | Callaway and Sant’Anna (2021). Matching and reweighting non-parametric estimator for staggered treatment. |
did |
csdid |
imputation / counterfactual / 2-stage | Borusyak et al (2024), Gardner (2021), and Liu et al (2024). Imputation estimator using a simple fixed effects design for staggered and non-absorbing treatment. |
fect did2s didimputation |
– |
interactive fixed effects (ifect) | Xu (2017) and Liu et al (2024). Imputation estimator using estimated latent trends for staggered and non-absorbing treatment. Can be semi-robust to parallel trends violations. |
fect |
– |
matrix completion (mc) | Athey (2017) and Liu et al (2024). Imputation estimator using computer-science matrix completion methods for staggered and non-absorbing treatment. Can be semi-robust to parallel trends violations. |
fect |
– |
did multiple | de Chaisemartin and D’Haultfœuille (2020, 2024). Matching and reweighting estimator that for staggered and non-absorbing treatment. Also handles continuous treatment. |
DIDmultiplegtDYN |
– |
panelmatch | Imai et al (2023). Matching and reweighting estimator for staggered and non-absorbing treatment. |
PanelMatch |
– |
extended twfe | Wooldridge (2021, 2023). Imputation estimator using two-way mundlak regression for staggered treatment. |
etwfe |
– |
Resource | Author | Notes |
---|---|---|
Yiqing Xu: modern advancements in DiD | Yiqing Xu | Useful overview of all modern DiD methods and R code. |
Asjad Naqvi: repository on DiD | Asjad Naqvi | Useful R and state code for DiD. |
User Guides for DiD | Brantly Callaway | Useful guides and explanations of DiD with R. |
Lecture: Problems with TWFE | Pedro Sant’Anna | Bacon decomposition and introduction to csdid. |
Causal Inference: The Mixtape | Scott Cunningham | Textbook chapter introducing DiD. |
Chiu et al (2025) | Chiu et al | Paper exploring new DiD methods and reanalysing old polisci papers. |
Roth et al (2025) | Roth et al | An overview of new DiD methods. |
Liu et al (2025) | Liu et al | An overview of imputation DiD methods. |