clusterSE: Compute clustered standard errors.

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

View source: R/clusterSE.R

Description

Compute clustered standard errors.

Usage

1
clusterSE(fit, cluster.var, data)

Arguments

fit

A model fit with plm (plm).

cluster.var

A character string naming the grouping/cluster variable.

data

A data frame containing cluster.var Only needed if cluster.var is not included in index. See 'Examples' below.

Value

Output from coeftest (lmtest) but with clustered standard errors.

Note

clusterSE does not work with models fit with lm, however a similar model can be fit with plm using the option model = "pooling". You can then use clusterSE to compute clustered standard errors and retest the coefficients.

Author(s)

Jonah Gabry <jsg2201@columbia.edu>

See Also

coeftest

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
# Model from plm help page:
data("Produc", package = "plm")
fit <- plm(log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp,
           data = Produc, index = c("state","year"), model = "random")

clusterSE(fit, cluster.var = "state") # don't need data argument since "state" is included in index

## End(Not run)

jgabry/QMSS_package documentation built on May 19, 2019, 7:18 a.m.