Regresses the outcome on group-by-time interactions in the pre-period and reports both per-period coefficients and a joint Wald (chi-square) test that they are all zero.
Usage
morie_did_test_parallel_trends(
data,
outcome,
treatment,
time,
unit = NULL,
cluster = NULL,
pre_periods = NULL
)Value
A list with coefficients, joint_chi2 (and
its alias joint_f_stat), joint_df,
joint_p_value, parallel_trends_plausible.
Examples
set.seed(1)
df <- expand.grid(unit = 1:30, time = 1:6)
df$treat <- as.integer(df$unit <= 15)
df$d <- as.integer(df$treat == 1L & df$time >= 4)
df$y <- 0.1 * df$time + 0.7 * df$d + rnorm(nrow(df), sd = 0.4)
res <- morie_did_test_parallel_trends(df, "y", "treat", "time",
pre_periods = c(1, 2, 3))
res$parallel_trends_plausible
#> [1] TRUE
