Skip to contents

Robust to heterogeneous and dynamic treatment effects. For every period t >= 2, DID_{+,t} contrasts the mean outcome change of the groups that switch into treatment against the groups that stay untreated, and DID_{-,t} contrasts the groups that stay treated against the groups that switch out. Either is set to zero when one of its two donor sets is empty, as the paper prescribes. The aggregate is DID_M = sum_t (N10_t/NS DID_{+,t} + N01_t/NS DID_{-,t}) with NS = sum_t (N10_t + N01_t).

Usage

Doctide(y, D, unit, time)

Arguments

y

Outcome, long format, one entry per unit-period.

D

Binary treatment indicator.

unit, time

Unit and period identifiers.

Value

List with estimate, periods, did_plus, did_minus, n10, n01, n_switch, n_units, n.

References

de Chaisemartin, C. and D'Haultfoeuille, X. (2020). Two-way fixed effects estimators with heterogeneous treatment effects. American Economic Review 110(9), 2964-2996; working paper arXiv:1803.08807, page 16.

Examples

set.seed(12)
d <- expand.grid(time = 1:4, unit = 1:20)
d$D <- as.integer(d$unit <= 10 & d$time >= 3)
d$y <- d$unit / 10 + d$time / 5 + 2 * d$D + rnorm(nrow(d), sd = 0.1)
Doctide(d$y, d$D, d$unit, d$time)$estimate   # close to 2
#> [1] 1.985514