vcovCESE {ceser} | R Documentation |
Cluster Estimated Standard Errors
Description
Cluster Estimated Standard Errors (CESE)
Usage
vcovCESE(mod, cluster = NULL, type = NULL)
Arguments
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 |
Value
The function returns a variance-covariace matrix of the coefficient estimates using the Cluster Estimated Standard Error (CESE) method.
References
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.
Examples
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')