Thanks to Kit Baum a Stata package called flexdid has been posted to SSC.
flexdid estimates average treatment effects on the treated (ATETs) in difference-in-differences designs with staggered implementation of treatment using a flexible linear model estimated by pooled OLS with covariates, (FLEX),as described in Deb et al. (2025). In the design, there must be at least one time-period in which all units are untreated, i.e., there cannot be any always-treated units. In addition, the typical design includes a set of never-treated units. FLEX can be specified using lags only parameters. In this case, the FLEX regression produces group by time effects that are identical to those produced by the estimator described in Borusyak et al. (2021). FLEX can also be specified using lags and leads parameters. In this case, when there are no covariates, the FLEX regression produces cohort by time effects that are identical to those produced by the regression adjustment estimator described in Callaway and Sant'Anna (2021).
flexdid allows for specification flexibility in a number of dimensions. The basic specification interacts all covariates with treatment, group and time indicators. Optionally, the user can select a subset of covariates tobe included in the interactions, with a larger set of covariates entering the regression in the typical additive manner. flexdid also allows the treatment group indicators to be disaggregates of cohorts, and for the group-level fixed effects in the regression to be different from (typically disaggregates of) the treatment group indicators. flexdid can handle designs with no never-treated units with additional identification assumptions. flexdid can also handle designs in which data is missing in some time-periods (periods in which cohorts of treatment started but are unobserved).
flexdid can be installed using the link that appears after typing findit flexdid or using ssc install flexdid.
Best regards,
Partha
References
Borusyak, K., Jaravel, X., & Spiess, J. (2024). "Revisiting Event-study Designs: Robust and Efficient Estimation", {it:Review of Economic Studies}, 91(6), 3253-3285.
Callaway, B. and Sant'Anna, P. H. C. (2021). "Difference-in-Differences with multiple time periods", {it:Journal of Econometrics}, 225(2):200-230.
Deb, P., Norton, E. C., Wooldridge, J. M., Zabel, J. E. (2025), "A Flexible, Heterogeneous Treatment Effects Difference-in-Differences Estimator for Repeated Cross-Sections", National Bureau of Economic Research, Working Paper Series, No. 33026.
flexdid estimates average treatment effects on the treated (ATETs) in difference-in-differences designs with staggered implementation of treatment using a flexible linear model estimated by pooled OLS with covariates, (FLEX),as described in Deb et al. (2025). In the design, there must be at least one time-period in which all units are untreated, i.e., there cannot be any always-treated units. In addition, the typical design includes a set of never-treated units. FLEX can be specified using lags only parameters. In this case, the FLEX regression produces group by time effects that are identical to those produced by the estimator described in Borusyak et al. (2021). FLEX can also be specified using lags and leads parameters. In this case, when there are no covariates, the FLEX regression produces cohort by time effects that are identical to those produced by the regression adjustment estimator described in Callaway and Sant'Anna (2021).
flexdid allows for specification flexibility in a number of dimensions. The basic specification interacts all covariates with treatment, group and time indicators. Optionally, the user can select a subset of covariates tobe included in the interactions, with a larger set of covariates entering the regression in the typical additive manner. flexdid also allows the treatment group indicators to be disaggregates of cohorts, and for the group-level fixed effects in the regression to be different from (typically disaggregates of) the treatment group indicators. flexdid can handle designs with no never-treated units with additional identification assumptions. flexdid can also handle designs in which data is missing in some time-periods (periods in which cohorts of treatment started but are unobserved).
flexdid can be installed using the link that appears after typing findit flexdid or using ssc install flexdid.
Best regards,
Partha
References
Borusyak, K., Jaravel, X., & Spiess, J. (2024). "Revisiting Event-study Designs: Robust and Efficient Estimation", {it:Review of Economic Studies}, 91(6), 3253-3285.
Callaway, B. and Sant'Anna, P. H. C. (2021). "Difference-in-Differences with multiple time periods", {it:Journal of Econometrics}, 225(2):200-230.
Deb, P., Norton, E. C., Wooldridge, J. M., Zabel, J. E. (2025), "A Flexible, Heterogeneous Treatment Effects Difference-in-Differences Estimator for Repeated Cross-Sections", National Bureau of Economic Research, Working Paper Series, No. 33026.