Learn R Programming

strucchange (version 1.0-2)

covHC: Heteroskedasticity-Consistent Covariance Matrix Estimation

Description

Heteroskedasticity-consistent estimation of the covariance matrix of the coefficient estimates in a linear regression model.

Usage

covHC(formula, type = c("HC2", "const", "HC", "HC1", "HC3"), tol = 1e-10,
   data=list())

Arguments

formula
a symbolic description for the model to be fitted.
type
a character string specifying the estimation type. For details see below.
tol
tolerance when solve is used
data
an optional data frame containing the variables in the model. By default the variables are taken from the environment which covHC is called from.

Value

  • A matrix containing the covariance matrix estimate.

Details

When type = "const" constant variances are assumed and and covHC gives the usual estimate of the covariance matrix of the coefficient estimates:

$$\hat \sigma^2 (X^\top X)^{-1}$$

All other methods do not assume constant variances and are suitable in case of heteroskedasticity. "HC" gives White's estimator; for details see the references.

References

MacKinnon J. G., White H. (1985), Some heteroskedasticity-consistent covariance matrix estimators with improved finite sample properties. Journal of Econometrics 29, 305-325

See Also

lm

Examples

Run this code
## generate linear regression relationship
## with homoskedastic variances
x <- sin(1:100)
y <- 1 + x + rnorm(100)
## compute usual covariance matrix of coefficient estimates
covHC(y~x, type="const")

sigma2 <- sum(residuals(lm(y~x))^2)/98
sigma2 * solve(crossprod(cbind(1,x)))

Run the code above in your browser using DataLab