ClusterVCV: Calculate clustered standard errors for (generalized) linear...

Description Usage Arguments Details Value Author(s) References Examples

View source: R/ClusterVCV.R

Description

This function is retained for backward compatibility, but is otherwise deprecated. See the multiwayvcov package for a general alternative or the plm package for a linear fixed effects model version.

Usage

1
ClusterVCV(model, data, cluster.var)

Arguments

model

A model of class lm or glm

data

Data frame used in estimation

cluster.var

Character name of the clustering variable

Details

The code implements the small sample correction of Cameron and Miller (2013).

Value

Variance-covariance matrix

Author(s)

Charlie Gibbons

References

Cameron, A. Colin and Douglas L. Miller. 2013. "A Practitioner's Guide to Cluster-Robust Inference." Journal of Human Resources (forthcoming).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
mtcars$cyl <- factor(mtcars$cyl)
reg <- lm(mpg ~ wt + cyl, data = mtcars)
vcv <- ClusterVCV(reg, mtcars, "cyl")

### To access the handy 'coeftest' function
library(lmtest)

### Not clustered
summary(reg)

### Clustered (it's interesting to note that the SEs get *smaller*)
coeftest(reg, vcv)

Brattle/BrattleExtras documentation built on Oct. 17, 2018, 8:58 a.m.