library(ggfixest) ## Will load fixest too
est = feols(y ~ x1 + i(period, treat, 5) | id + period, base_did)
# Default hypothesis test is a null mean post-treatment effect
(post_mean = aggr_es(est))
# The underlying hypothesis is saved as an attribute
attributes(post_mean)["hypothesis"]
# Other hypothesis and aggregation options
aggr_es(est, aggregation = "cumulative") # cumulative instead of mean effects
aggr_es(est, period = "pre") # pre period instead of post
aggr_es(est, period = "both") # pre & post periods separately
aggr_es(est, period = 6:8) # specific subset of periods
aggr_es(est, rhs = -1, period = "pre") # pre period with H0 value of 1
# Etc.
Run the code above in your browser using DataLab