Description Usage Arguments Value References Examples
Cluster Estimated Standard Errors (CESE)
1 |
mod |
a model object. It can be the output of the functions |
cluster |
either a string vector with the name of the variables that will be used to cluster the standard errors, or a formula - e.g., ~ rhs, with a summation of the variables that will be used to cluster the standard errors replacing the |
type |
string with either |
The function returns a variance-covariace matrix of the coefficient estimates using the Cluster Estimated Standard Error (CESE) method.
Jackson, John (2019) Corrected Standard Errors with Clustered Data. Political Analysis.
Hayes, A. F., & Cai, L., (2007) Using heteroskedasticity-consistent standard error estimators in ols regression: an introduction and software implementation, Behavior research methods, 39(4), 709–722.
Davidson, R., & MacKinnon, J. G., (2004) Econometric theory and methods: Oxford University Press New York.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 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')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.