vcovCluster: Cluster Heteroskedasticity-consistent estimation of the...

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/clusterInf.R

Description

Offer a cluster variant of the usual Heteroskedasticity-consistent

Usage

1
2
3
vcovCluster(object, clusterVar)

vcovCluster2(object, clusterVar1, clusterVar2)

Arguments

object

Object of class lm, from which rdd_reg also inherits.

clusterVar

The variable containing the cluster attributions.

clusterVar1, clusterVar2

The two cluster variables for the 2-cluster case.

Value

A matrix containing the covariance matrix estimate.

Author(s)

Mahmood Arai, see http://people.su.se/~ma/econometrics.html

References

Cameron, C., Gelbach, J. and Miller, D. (2011) Robust Inference With Multiway Clustering, Journal of Business and Economic Statistics, vol. 29(2), pages 238-249. #' @references Wooldridge (2003) Cluster-sample methods in applied econometrics. American Economic Review, 93, p. 133-138

Arai, M. (2011) Cluster-robust standard errors using R, Note available http://people.su.se/~ma/clustering.pdf.

See Also

clusterInf for a direct function, allowing also alternative cluster inference methods.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data(STAR_MHE)
if(all(c(require(sandwich), require(lmtest)))){

# Run simple regression:
reg_krug <- lm(pscore~cs, data=STAR_MHE)

# Row 1 of Table 8.2.1, inference with standard vcovHC:
coeftest(reg_krug,vcov.=vcovHC(reg_krug, 'HC1'))[2,2]

# Row 4 of Table 8.2.1, inference with cluster vcovHC:
coeftest(reg_krug,vcov.=vcovCluster(reg_krug, clusterVar=STAR_MHE$classid))[2,2]
}

rddtools documentation built on Jan. 10, 2022, 5:07 p.m.