sandwich.se: Sandwich SE

View source: R/lmrse.R

sandwich.seR Documentation

Sandwich SE

Description

sandwich.se fits cluster robust standard errors using a sandwich estimator.

Usage

sandwich.se(model, cluster)

Arguments

model

output from linear model

cluster

clustering variable

Value

sandwich.se returns a vector of robust standard errors for the covariables including the intercept.

Author(s)

James Staley jrstaley95@gmail.com

Examples

# 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)


jrs95/lmrse documentation built on Jan. 15, 2024, 3:48 a.m.