# NOT RUN {
mod = lm(enep ~ enpc + fapres + enpcfapres + proximity + eneg + logmag + logmag_eneg , data=dcese)
## --------------------------------------
## Getting the variance covariance matrix
## --------------------------------------
## Original variance-covariance matrix (no clustered std. errors)
vcov(mod)
## Variance-covariance matrix using CRSE (sandwish package)
## sandwich::vcovCL(mod, cluster = ~ country)
## sandwich::vcovCL(mod, cluster = ~ country, type="HC3")
## Variance-covariance matrix using CESE
ceser::vcovCESE(mod, cluster = ~ country)
ceser::vcovCESE(mod, cluster = ~ country, type="HC3") # HC3 correction
## ---------
## Summaries
## ---------
## no robust SE
summary(mod)
## summary table using CRSE (sandwich package)
## lmtest::coeftest(mod, vcov = sandwich::vcovCL, cluster = ~ country)
## summary using CESE
lmtest::coeftest(mod, vcov = ceser::vcovCESE, cluster = ~ country, type='HC3')
# }
Run the code above in your browser using DataLab