Convenience wrapper around morie_did_group_time_att and
morie_did_aggregate_gt_att.
Usage
morie_did_staggered(
data,
outcome,
unit,
time,
treatment_time,
covariates = NULL,
n_bootstrap = 200L,
seed = 42L,
alpha = 0.05
)Arguments
- data
Panel data.
- outcome
Outcome column.
- unit
Unit identifier.
- time
Calendar-time column (integer).
- treatment_time
Column with treatment-onset period (use
Inffor never-treated).- covariates
Optional covariates for doubly-robust estimation.
- n_bootstrap
Number of multiplier-bootstrap replications for inference (0 = analytic influence-function standard errors).
- seed
RNG seed for the multiplier bootstrap.
- alpha
Significance level.
Examples
set.seed(2)
df <- expand.grid(unit = 1:40, time = 1:6)
df$treat_time <- ifelse(df$unit <= 20, 4, Inf)
df$d <- as.integer(df$time >= df$treat_time)
df$y <- 0.1 * df$time + 0.6 * df$d + rnorm(nrow(df), sd = 0.4)
out <- morie_did_staggered(df, "y", "unit", "time", "treat_time",
n_bootstrap = 50L, seed = 2)
str(out, max.level = 1)
#> List of 4
#> $ group_time :'data.frame': 5 obs. of 7 variables:
#> ..- attr(*, "fit")=List of 3
#> $ overall :'data.frame': 1 obs. of 5 variables:
#> $ by_cohort :'data.frame': 1 obs. of 5 variables:
#> $ by_event_time:'data.frame': 5 obs. of 5 variables:
