# A minimal example
eventstudy_model <-
EventStudy(
estimator = "OLS",
data = example_data,
outcomevar = "y_base",
policyvar = "z",
idvar = "id",
timevar = "t",
pre = 0, post = 3,
normalize = -1
)
### Access estimated model
eventstudy_model$output
summary(eventstudy_model$output)
### data.frame of estimates
estimatr::tidy(eventstudy_model$output)
### Access arguments
eventstudy_model$arguments
# A dynamic OLS model with anticipation effects and controls
eventstudy_model_dyn <-
EventStudy(
estimator = "OLS",
data = example_data,
outcomevar = "y_base",
policyvar = "z",
idvar = "id",
timevar = "t",
controls = "x_r",
FE = TRUE, TFE = TRUE,
post = 3, overidpost = 5,
pre = 2, overidpre = 4,
normalize = - 3,
cluster = TRUE,
anticipation_effects_normalization = TRUE
)
summary(eventstudy_model_dyn$output)
# A static model
eventstudy_model_static <-
EventStudy(
estimator = "OLS",
data = example_data,
outcomevar = "y_jump_m",
policyvar = "z",
idvar = "id",
timevar = "t",
FE = TRUE, TFE = TRUE,
post = 0, overidpost = 0,
pre = 0, overidpre = 0,
cluster = TRUE
)
summary(eventstudy_model_static$output)
# A dynamic model with an unbalanced panel
data_unbal <- example_data[1:(nrow(example_data)-1),] # drop last row to make unbalanced
eventstudy_model_unbal <-
EventStudy(
estimator = "OLS",
data = data_unbal,
outcomevar = "y_base",
policyvar = "z",
idvar = "id",
timevar = "t",
pre = 0, post = 3,
normalize = -1
)
summary(eventstudy_model_unbal$output)
# A dynamic model estimated using IV
eventstudy_model_iv <-
EventStudy(
estimator = "FHS",
data = example_data,
outcomevar = "y_base",
policyvar = "z",
idvar = "id",
timevar = "t",
proxy = "x_r",
FE = TRUE, TFE = TRUE,
post = 2, overidpost = 1,
pre = 0, overidpre = 3,
normalize = -1,
cluster = TRUE
)
summary(eventstudy_model_iv$output)
Run the code above in your browser using DataLab