# NOT RUN {
# Load trade data
data(trade)
# We estimate the effect of distance on trade (with 3 fixed-effects)
est = feols(log(Euros) ~ log(dist_km)|Origin+Destination+Product, trade)
# Squared correlation:
r2(est, "sq.cor")
# "regular" r2:
r2(est, "r2")
# pseudo r2 (equivalent to GLM with Gaussian family)
r2(est, "pr2")
# adjusted within r2
r2(est, "war2")
# all four at once
r2(est, c("sq.cor", "r2", "pr2", "war2"))
# same with full names instead of codes
r2(est, c("sq.cor", "r2", "pr2", "war2"), full_names = TRUE)
# }
Run the code above in your browser using DataLab