Skip to content
Compute Cluster Estimated Standard Error (CESE)
R
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R
data
docs
inst
man
pkgdown/favicon
src
vignettes
.travis.yml
CRAN-RELEASE
DESCRIPTION
LICENSE
LICENSE.md
NAMESPACE
NEWS.md
README.org
_pkgdown.yml
cran-comments.md

README.org

CESER

https://travis-ci.org/DiogoFerrari/ceser.svg

Overview

The package provides a function to compute Cluster Estimated Standard Errors (CESE).

For details, see Jackson, John (2019) Corrected Standard Errors with Clustered Data. Political Analysis.

Instalation

devtools::install_github("DiogoFerrari/ceser")
# If you don't want to update the dependencies, use: (you may need to install some dependencies manually)
devtools::install_github("DiogoFerrari/ceser", dependencies=F)

NOTE: it may be necessary to create a token to install the package from the git repository in case it is private (see note at the bottom of help page in R by running help(install_github)).

Usage

Here is a simple example (for more information, see help(ceser) and help(vocvCESE)).

library(ceser)

data(dcese)
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')
You can’t perform that action at this time.