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

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.7024262 0.4268083 -1.53895513 0.1341027 1
#> 2       -3 -0.3097243 0.3804991 -1.05548877 0.4360402 2
#> 3       -2 -0.2022450 0.3446246 -0.87769668 0.4732068 2
#> 4        0  2.2266588 0.3914358  1.45945861 2.9938589 2
#> 5        1  2.0837729 0.3502110  1.39737182 2.7701739 2
#> 6        2  2.0366278 0.3755970  1.30047124 2.7727844 2
#> 7        3  1.2995933 0.6179321  0.08846859 2.5107180 1
#> 8        4  2.2413764 0.5425262  1.17804454 3.3047082 1