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
if (morie_crypto_liboqs_available()) {
if (requireNamespace("DRDID", quietly = TRUE)) {
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)
}
}
