sandwich.se | R Documentation |
sandwich.se
fits cluster robust standard errors using a
sandwich estimator.
sandwich.se(model, cluster)
model |
output from linear model |
cluster |
clustering variable |
sandwich.se
returns a vector of robust standard errors for the
covariables including the intercept.
James Staley jrstaley95@gmail.com
# Data
y <- rnorm(5000)
x <- rnorm(5000)
cluster <- rep(1:1000, 5)
c1 <- rbinom(5000, 1, 0.5)
c2 <- rnorm(5000)
# Analyses
model <- lm(y ~ x + c1 + c2)
se <- sandwich.se(model = model, cluster = cluster)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.