Skip to contents

Native DID-M estimator: the instantaneous treatment effect for switchers. For each pair of consecutive periods, joiners (0 to 1) are compared with groups stable at 0 and leavers (1 to 0) with groups stable at 1, and the per-period DiDs are averaged with switcher-count weights. Standard errors come from a cluster (group) bootstrap.

Usage

morie_did_chaisemartin_dhaultfoeuille(
  data,
  outcome,
  treatment,
  unit,
  time,
  n_bootstrap = 200L,
  seed = 42L,
  alpha = 0.05
)

Arguments

data

Panel data.

outcome, treatment, unit, time

Column names.

n_bootstrap

Cluster-bootstrap replications for the standard error (0 = point estimate only, SE is NA).

seed

RNG seed.

alpha

Significance level.

Value

A result list; see morie_did_2x2.

References

de Chaisemartin, C., & D'Haultfoeuille, X. (2020). Two-way fixed effects estimators with heterogeneous treatment effects. American Economic Review, 110(9), 2964–2996.

Examples

set.seed(9)
df <- expand.grid(unit = 1:60, time = 1:6)
df$treat_time <- ifelse(df$unit <= 30, 4, Inf)
df$d <- as.integer(df$time >= df$treat_time)
df$y <- 0.5 * df$time + 1.5 * df$d + rnorm(nrow(df), sd = 0.5)
res <- morie_did_chaisemartin_dhaultfoeuille(df, "y", "d", "unit", "time",
                                             n_bootstrap = 50L, seed = 9)
res$estimate
#> [1] 1.331897