Open kennchua opened 1 year ago
In the package example for two-way fixed effects and sunab(), we can get the ATT as follows:
data(base_stagg) res_twfe = feols(y ~ x1 + i(time_to_treatment, treated, ref = c(-1, -1000)) | id + year, base_stagg) aggregate(res_twfe, c("ATT" = "treatment::[^-]")) res_sunab = feols(y ~ x1 + sunab(year_treated, year) | id + year, base_stagg) aggregate(res_sunab, c("ATT" = "year::[^-]"))
How would one approach getting the ATT for a subset of the periods (e.g. 0-3)? I tried the following for TWFE regressions:
aggregate(res_twfe, c("ATT" = "time_to_treatment::(0|1|2|3):treated$"))
But it just returns the estimates for each period rather than an aggregate.
I think it's possible to use something like the marginaleffects::hypotheses() command.
marginaleffects::hypotheses()
marginaleffects::hypotheses(res_twfe, paste("(",paste(paste("`", paste("time_to_treatment::", 0:3, ":treated", sep = ""), "`", sep = ""), collapse = "+"), ")/4=0", sep = "")) |> broom::tidy()
But in order to do this for output of sunab(), I would need the aggregated variance-covariance matrix.
sunab()
Would appreciate any leads on how to aggregate effects for a range of post-treatment periods particularly for sunab() regressions.
Possible duplicate of #295.
In the package example for two-way fixed effects and sunab(), we can get the ATT as follows:
How would one approach getting the ATT for a subset of the periods (e.g. 0-3)? I tried the following for TWFE regressions:
But it just returns the estimates for each period rather than an aggregate.
I think it's possible to use something like the
marginaleffects::hypotheses()
command.But in order to do this for output of
sunab()
, I would need the aggregated variance-covariance matrix.Would appreciate any leads on how to aggregate effects for a range of post-treatment periods particularly for sunab() regressions.