clusterInf {rddtools} | R Documentation |
Post-inference for clustered data
Description
Correct standard-errors to account for clustered data, doing either a degrees of freedom correction or using a heteroskedasticidty-cluster robust covariance matrix possibly on the range specified by bandwidth
Usage
clusterInf(object, clusterVar, vcov. = NULL, type = c("df-adj", "HC"), ...)
Arguments
object |
Object of class lm, from which rdd_reg also inherits. |
clusterVar |
The variable containing the cluster attributions. |
vcov. |
Specific covariance function to pass to coeftest. See help of sandwich |
type |
The type of cluster correction to use: either the degrees of freedom, or a HC matrix. |
... |
Further arguments passed to coeftest |
Value
The output of the coeftest function, which is itself of class coeftest
References
Wooldridge (2003) Cluster-sample methods in applied econometrics. AmericanEconomic Review, 93, p. 133-138
See Also
vcovCluster
, which implements the cluster-robust covariance matrix estimator used by cluserInf
Examples
data(house)
house_rdd <- rdd_data(y=house$y, x=house$x, cutpoint=0)
reg_para <- rdd_reg_lm(rdd_object=house_rdd)
# here we just generate randomly a cluster variable:
nlet <- sort(c(outer(letters, letters, paste, sep='')))
clusRandom <- sample(nlet[1:60], size=nrow(house_rdd), replace=TRUE)
# now do post-inference:
clusterInf(reg_para, clusterVar=clusRandom)
clusterInf(reg_para, clusterVar=clusRandom, type='HC')