#----------------------------------------------------------
# Triple Diff with multiple time periods
#----------------------------------------------------------
data <- gen_dgp_mult_periods(size = 500, dgp_type = 1)[["data"]]
out <- ddd(yname = "y", tname = "time", idname = "id",
gname = "state", pname = "partition", xformla = ~cov1 + cov2 + cov3 + cov4,
data = data, control_group = "nevertreated", base_period = "varying",
est_method = "dr")
# Simple aggregation
agg_ddd(out, type = "simple", alpha = 0.10)
# Event study aggregation
agg_ddd(out, type = "eventstudy", alpha = 0.10)
# Group aggregation
agg_ddd(out, type = "group", alpha = 0.10)
# Calendar aggregation
agg_ddd(out, type = "calendar", alpha = 0.10)
Run the code above in your browser using DataLab