Acknowledgements#

Like many open-source software projects, ModernDiD builds on work and ideas first developed in other packages. In this section, we want to acknowledge and express our appreciation for the authors of these packages and their creativity and hard work.

Software#

Unless explicitly stated otherwise, all ModernDiD code is written independently from scratch. The packages listed below have influenced ModernDiD’s API design or algorithmic choices, or are used for testing ModernDiD as reference implementations, but no source code has been copied except where explicitly stated (with license and permission details provided inline).

did (R)#

The did R package by Brantly Callaway and Pedro H.C. Sant’Anna is the foundation of ModernDiD’s multi-period staggered DiD estimator. The att_gt() function in ModernDiD implements the methodology in Callaway and Sant’Anna (2021) and follows the did package’s API conventions for specifying group-time average treatment effects, aggregation schemes, and inference.

More concretely, we have borrowed the following API conventions and ideas directly from did:

  • Core APIatt_gt() function and argument names (yname, tname, idname, gname), control group options (never_treated, not_yet_treated), and anticipation period handling

  • Aggregationaggte() function with aggregation types (group, dynamic, calendar, simple) directly mirrors the R package

  • Estimation methods – The doubly robust (dr), inverse probability weighting (ipw), and outcome regression (reg) estimation method options

  • Inference – Analytical standard error formulas and multiplier bootstrap for simultaneous confidence bands

  • Plottingplot_gt() and plot_event_study() follow the visual conventions of did’s ggdid()

You can learn more about did on GitHub or by reading the associated paper.

ModernDiD is benchmarked and validated against did via R scripts to ensure numerical equivalence for coefficients, standard errors, and confidence intervals.

DRDID (R)#

The DRDID R package by Pedro H.C. Sant’Anna and Jun Zhao is the foundation for ModernDiD’s two-period doubly robust estimators in the drdid module. The methodology follows Sant’Anna and Zhao (2020), which develops locally efficient doubly robust DiD estimators for both panel and repeated cross-section settings.

ModernDiD implements all estimators from the DRDID package: the doubly robust improved estimator (drdid_imp_rc()), traditional doubly robust (drdid_rc()), IPW estimators (ipw_did_rc()), and outcome regression estimators (reg_did_rc()), for both panel data and repeated cross-sections.

You can learn more about DRDID on GitHub or by reading the associated paper.

ModernDiD is benchmarked and validated against DRDID via R scripts to ensure numerical equivalence.

contdid (R)#

The contdid R package by Brantly Callaway, Andrew Goodman-Bacon, and Pedro H.C. Sant’Anna is the basis for ModernDiD’s continuous treatment DiD estimator. The cont_did() function implements the methodology in Callaway, Goodman-Bacon, and Sant’Anna (2024), which extends the DiD framework to settings where treatment intensity varies continuously across units.

You can learn more about contdid on GitHub or by reading the associated paper.

ModernDiD is benchmarked and validated against contdid via R scripts to ensure numerical equivalence.

npiv (R)#

The npiv R package by Jeffrey S. Racine and Timothy M. Christensen implements nonparametric instrumental variables estimation and uniform confidence band construction using sieve-based methods. ModernDiD uses the methodology from Chen and Christensen (2018) and Chen, Christensen, and Kankanala (2024) for the nonparametric dose-response estimation in the continuous DiD estimator cont_did().

You can learn more about npiv on GitHub or by reading the associated papers by Chen and Christensen (2018) and Chen, Christensen, and Kankanala (2024).

triplediff (R)#

The triplediff R package by Marcel Ortiz-Villavicencio and Pedro H.C. Sant’Anna is the basis for ModernDiD’s triple difference-in-differences estimator. The ddd() function implements the methodology in Ortiz-Villavicencio and Sant’Anna (2025), which develops doubly robust triple DiD estimators for staggered adoption designs.

You can learn more about triplediff on GitHub or by reading the associated paper.

ModernDiD is benchmarked and validated against triplediff via R scripts to ensure numerical equivalence.

DynBalancing (R)#

The DynBalancing R package by Davide Viviano and Jelena Bradic is the basis for ModernDiD’s dynamic covariate balancing DiD estimator. The dyn_balancing() function implements the methodology in Viviano and Bradic (2026), which estimates treatment effects in panel data with time-varying treatments using sequential covariate balancing weights and potential local projections.

You can learn more about DynBalancing on GitHub or by reading the associated paper.

ModernDiD is benchmarked and validated against DynBalancing via R scripts to ensure numerical equivalence.

did_multiplegt_dyn (R / Stata / Python)#

The did_multiplegt_dyn package (available in R and Stata and Python) by Clément de Chaisemartin and Xavier D’Haultfoeuille is the basis for ModernDiD’s intertemporal treatment effects estimator. The did_multiplegt() function implements the methodology in de Chaisemartin and D’Haultfoeuille (2024), which estimates treatment effects in settings with potentially non-binary, non-absorbing treatments.

You can learn more about did_multiplegt_dyn on GitHub or by reading the associated paper.

ModernDiD is validated against did_multiplegt_dyn via R scripts to ensure numerical equivalence.

etwfe (R)#

The etwfe R package by Grant McDermott is the basis for ModernDiD’s Extended Two-Way Fixed Effects estimator. The etwfe() and emfx() functions implement the methodology in Wooldridge (2025), which shows that a fully saturated TWFE regression with cohort-by-time interactions recovers heterogeneous treatment effects without the negative weighting problem of conventional TWFE.

More concretely, we have borrowed the following API conventions and ideas directly from etwfe:

  • Core APIetwfe() function and argument structure (outcome formula, tvar/gvar naming, cgroup control group options, fe fixed effects specification)

  • Aggregationemfx() function with aggregation types (simple, event, group, calendar) and post_only/window options

  • Nonlinear models – Support for Poisson, logit, and probit families via the family parameter, following the approach in Wooldridge (2023)

  • Covariate handling – Mundlak device for within-cohort demeaning of control variables

  • Heterogeneous effectsxvar parameter for treatment effect heterogeneity by a categorical covariate

You can learn more about etwfe on GitHub or by reading the associated papers by Wooldridge (2025) and Wooldridge (2023).

ModernDiD is benchmarked and validated against etwfe via R scripts to ensure numerical equivalence for coefficients, standard errors, and aggregated treatment effects across all aggregation types, control group strategies, fixed effects specifications, and nonlinear model families.

HonestDiD (R)#

The HonestDiD R package by Ashesh Rambachan and Jonathan Roth is the basis for ModernDiD’s sensitivity analysis tools. The honest_did() function implements the methodology in Rambachan and Roth (2023), which provides a more credible approach to evaluating the parallel trends assumption by constructing robust confidence sets under violations of parallel trends.

You can learn more about HonestDiD on GitHub or by reading the associated paper.

PyFixest (Python)#

PyFixest by Alexander Fischer is a fast and user-friendly fixed effects regression package for Python. ModernDiD uses pyfixest as the regression backend for the ETWFE estimator (etwfe()), where it handles the saturated interaction regression with high-dimensional fixed effects absorption. PyFixest’s approach to building an ergonomic Python econometrics library has also influenced ModernDiD’s API design philosophy.

You can learn more about PyFixest on GitHub or via its documentation.

Other software#

Here we list other foundational software without which a project like ModernDiD would not be possible:

  • NumPy – Array computing

  • SciPy – Scientific computing

  • Polars – Fast DataFrames for internal data wrangling

  • Narwhals – DataFrame-agnostic compatibility layer

  • PyArrow – Apache Arrow for Python

  • statsmodels – Statistical models

  • Numba – JIT compilation for numerical code

  • scikit-learn – Machine learning (LASSO, Ridge)

  • CuPy – GPU-accelerated array computing

  • Dask – Distributed computing

  • PySpark – Distributed computing on Spark

  • plotnine – Grammar of graphics plotting

  • CVXPY – Convex optimization

  • formulaic – Formula parsing

  • PrettyTable – Table formatting

Papers and algorithms#

The following papers describe the core methodologies implemented in ModernDiD:

  • Abadie, A. (2005). “Semiparametric Difference-in-Differences Estimators.” Review of Economic Studies, 72(1), 1-19. DOI:10.1111/0034-6527.00321.

  • Callaway, B., & Sant’Anna, P. H. C. (2021). “Difference-in-Differences with Multiple Time Periods.” Journal of Econometrics, 225(2), 200-230. DOI:10.1016/j.jeconom.2020.12.001.

  • Callaway, B., Goodman-Bacon, A., & Sant’Anna, P. H. C. (2024). “Difference-in-Differences with a Continuous Treatment.” arXiv:2107.02637.

  • Chen, X., & Christensen, T. M. (2018). “Optimal Sup-norm Rates and Uniform Inference on Nonlinear Functionals of Nonparametric IV.” Quantitative Economics, 9(1), 39-84. DOI:10.3982/QE722.

  • Chen, X., Christensen, T. M., & Kankanala, S. (2024). “Adaptive Estimation and Uniform Confidence Bands for Nonparametric Structural Functions and Elasticities.” arXiv:2107.11869.

  • de Chaisemartin, C., & D’Haultfoeuille, X. (2024). “Difference-in-Differences Estimators of Intertemporal Treatment Effects.” Review of Economics and Statistics, 106(6), 1723-1736. DOI:10.1162/rest_a_01414.

  • Graham, B., Pinto, C., & Egel, D. (2012). “Inverse Probability Tilting for Moment Condition Models with Missing Data.” Review of Economic Studies, 79(3), 1053-1079. DOI:10.1093/restud/rdr047.

  • Ortiz-Villavicencio, M., & Sant’Anna, P. H. C. (2025). “Better Understanding Triple Differences Estimators.” arXiv:2505.09942.

  • Rambachan, A., & Roth, J. (2023). “A More Credible Approach to Parallel Trends.” Review of Economic Studies, 90(5), 2555-2591. DOI:10.1093/restud/rdad018.

  • Sant’Anna, P. H. C., & Zhao, J. (2020). “Doubly Robust Difference-in-Differences Estimators.” Journal of Econometrics, 219(1), 101-122. DOI:10.1016/j.jeconom.2020.06.003.

  • Viviano, D., & Bradic, J. (2026). “Dynamic Covariate Balancing: Estimating Treatment Effects over Time with Potential Local Projections.” Biometrika, asag016. DOI:10.1093/biomet/asag016.

  • Wooldridge, J. M. (2023). “Simple Approaches to Nonlinear Difference-in-Differences with Panel Data.” The Econometrics Journal, 26(3), C31-C66. DOI:10.1093/ectj/utad016.

  • Wooldridge, J. M. (2025). “Two-Way Fixed Effects, the Two-Way Mundlak Regression, and Difference-in-Differences Estimators.” Empirical Economics. DOI:10.1007/s00181-025-02807-z.