Skip to contents

Saturated cohort-by-relative-time event study: each (cohort, rel time) cell gets its own coefficient via the native TWFE demeaner (never-treated units as the clean control group), then the cell coefficients are aggregated to relative-time effects with cohort-share weights – the IW estimator that is immune to the negative-weighting contamination of a pooled event study.

Usage

morie_did_sun_abraham(
  data,
  outcome,
  unit,
  time,
  treatment_time,
  leads = 4L,
  lags = 4L,
  alpha = 0.05
)

Arguments

data

Long panel data frame.

outcome, unit, time

Column names.

treatment_time

First treated period per unit (NA = never).

leads, lags

Relative-time window to report. Defaults -4..4.

alpha

CI tail.

Value

data.frame: rel_time, estimate, std.error, conf.low, conf.high, n; attribute "cells" holds the (cohort, rel) cell coefficients.

References

Sun & Abraham (2021) J. Econometrics 225(2).

Examples

set.seed(1)
df <- expand.grid(id = 1:40, t = 1:8)
df$g <- ifelse(df$id <= 12, 4L, ifelse(df$id <= 24, 6L, NA))
df$y <- rnorm(nrow(df)) + ifelse(!is.na(df$g) & df$t >= df$g, 2, 0)
morie_did_sun_abraham(df, "y", "id", "t", "g")
#>   rel_time    estimate std.error   conf.low conf.high n
#> 1       -4  0.04743233 0.6803687 -1.2860658 1.3809304 1
#> 2       -3 -0.19145897 0.3825681 -0.9412786 0.5583606 2
#> 3       -2 -0.20764672 0.2888676 -0.7738169 0.3585235 2
#> 4        0  1.98150195 0.3580736  1.2796905 2.6833134 2
#> 5        1  2.08999433 0.4133734  1.2797973 2.9001913 2
#> 6        2  2.25617296 0.3635836  1.5435622 2.9687837 2
#> 7        3  2.11055383 0.5671107  0.9990373 3.2220704 1
#> 8        4  1.95156205 0.4195810  1.1291984 2.7739257 1