if (FALSE) { # rlang::is_installed("fixest")
# load libraries for models and data
library(fixest)
gravity <-
feols(
log(Euros) ~ log(dist_km) | Origin + Destination + Product + Year, trade
)
tidy(gravity)
glance(gravity)
augment(gravity, trade)
# to get robust or clustered SEs, users can either:
# 1) specify the arguments directly in the `tidy()` call
tidy(gravity, conf.int = TRUE, cluster = c("Product", "Year"))
tidy(gravity, conf.int = TRUE, se = "threeway")
# 2) or, feed tidy() a summary.fixest object that has already accepted
# these arguments
gravity_summ <- summary(gravity, cluster = c("Product", "Year"))
tidy(gravity_summ, conf.int = TRUE)
# approach (1) is preferred.
}
Run the code above in your browser using DataLab