lm_cluster | R Documentation |
This function calculates standard errors with clustered erros and add them to the linear model fit object with a named vector "se_cluster". This vector can be used in stargazer.
lm_cluster(data, formula, cluster, ...)
## Petersen's data
data("PetersenCL", package = "sandwich")
m <- lm(y ~ x, data = PetersenCL)
## clustered covariances
m1 <- lm_cluster(y ~ x, data = PetersenCL, cluster=firm)
summary(m1)
m1$se_cluster
m1$vcov_cluster
stargazer(m, m1, se=list(NULL, m1$se_cluster))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.