View source: R/did_multiplegt.R
did_multiplegt | R Documentation |
Library of Estimators in Difference-in-Difference (DID) designs with multiple groups and periods.
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 DID_M
, i.e. the average across t
and d
of the treatment effects of groups that have treatment d
at t-1
and change their treatment at t
, using groups that have treatment d
at t-1
and t
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)
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.