| Title: | Estimators DID with Multiple Groups and Periods |
|---|---|
| Description: | Estimators of Difference-in-Differences based on de Chaisemartin and D'Haultfoeuille. |
| Authors: | Anzony Quispe [aut, cre], Diego Ciccia [aut], Felix Knau [aut], Mélitine Malezieux [aut], Doulo Sow [aut], Shuo Zhang [aut], Clément de Chaisemartin [aut] |
| Maintainer: | Anzony Quispe <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 2.1.0 |
| Built: | 2026-10-07 11:42:48 UTC |
| Source: | https://github.com/credible-answers/did_multiplegt |
Library of Estimators in Difference-in-Difference (DID) designs with multiple groups and periods.
did_multiplegt(mode, ...)did_multiplegt(mode, ...)
mode |
("dyn", "had", "old") Estimator selector. The |
... |
Options passed to specified estimator. For more details on allowed options, check out the command-specific documentation: did_multiplegt_dyn, did_had, did_multiplegt_old. |
did_multiplegt wraps in a single command all the estimators from de Chaisemartin and D'Haultfoeuille. Depending on the mode argument, this command can be used to call the following estimators.
did_multiplegt_dyn. In dyn mode, the command computes the DID event-study estimators introduced in de Chaisemartin and D'Haultfoeuille (2024a). This mode can be used both with a binary and staggered (absorbing) treatment and a non-binary treatment (discrete or continuous) that can increase or decrease multiple times. The estimator is also robust to heterogeneous effects of the current and lagged treatments. Lastly, it can be used with data where the panel st is unblanced or more disaggregated than the group level.
did_had. In had mode, the command computes the DID estimator introduced in de Chaisemartin and D'Haultfoeuille (2024b). This mode estimates the effect of a treatment on an outcome in a heterogeneous adoption design (HAD) with no stayers but some quasi stayers.
did_multiplegt_old. In old mode, the command computes the DID estimators introduced in de Chaisemartin and D'Haultfoeuille (2020). This mode corresponds to the old version of the did_multiplegt command. Specifically, it can be used to estimate , i.e. the average across and of the treatment effects of groups that have treatment at and change their treatment at , using groups that have treatment at and as controls. This mode could also be used to compute event-study estimates, but we strongly suggest to use the dyn mode, since it is way faster and includes comprehensive estimation and post-estimation support.
de Chaisemartin, C and D'Haultfoeuille, X (2020). American Economic Review, vol. 110, no. 9. Two-Way Fixed Effects Estimators with Heterogeneous Treatment Effects.
de Chaisemartin, C and D'Haultfoeuille, X (2024a). Review of Economics and Statistics, 1-45. Difference-in-Differences Estimators of Intertemporal Treatment Effects.
de Chaisemartin, C and D'Haultfoeuille, X (2024b). Two-way Fixed Effects and Differences-in-Differences Estimators in Heterogeneous Adoption Designs.
Vella, F. and Verbeek, M. 1998. Journal of Applied Econometrics 13(2), 163–183. Whose wages do unions raise? a dynamic model of unionism and wage rate determination for young men.
# Test all modes using Vella and Verbeek (1998) data: data("wagepan_mgt") wagepan_mgt$X <- runif(n=nrow(wagepan_mgt)) * (wagepan_mgt$year >= 1983) Y = "lwage" G = "nr" T = "year" D = "union" X = "X" did_multiplegt(mode = "old", wagepan_mgt, Y, G, T, D) ## Not run: # These examples require polars package to be installed did_multiplegt(mode = "dyn", wagepan_mgt, Y, G, T, D, graph_off = TRUE) did_multiplegt(mode = "had", wagepan_mgt, Y, G, T, X, graph_off = TRUE) ## End(Not run)# Test all modes using Vella and Verbeek (1998) data: data("wagepan_mgt") wagepan_mgt$X <- runif(n=nrow(wagepan_mgt)) * (wagepan_mgt$year >= 1983) Y = "lwage" G = "nr" T = "year" D = "union" X = "X" did_multiplegt(mode = "old", wagepan_mgt, Y, G, T, D) ## Not run: # These examples require polars package to be installed did_multiplegt(mode = "dyn", wagepan_mgt, Y, G, T, D, graph_off = TRUE) did_multiplegt(mode = "had", wagepan_mgt, Y, G, T, X, graph_off = TRUE) ## End(Not run)
A subset of data from Vella and Verbeek (1998).
wagepan_mgtwagepan_mgt
## 'wagepan_mgt' A data frame with 4,360 rows and 5 columns:
Log wage.
Worker ID.
Year
Union status.
Annual Hours worked.
<http://fmwww.bc.edu/ec-p/data/wooldridge/wagepan.des>