`vcovHAC.Rd`

Heteroscedasticity and autocorrelation consistent (HAC) estimation of the covariance matrix of the coefficient estimates in a (generalized) linear regression model.

vcovHAC(x, ...) # S3 method for default vcovHAC(x, order.by = NULL, prewhite = FALSE, weights = weightsAndrews, adjust = TRUE, diagnostics = FALSE, sandwich = TRUE, ar.method = "ols", data = list(), ...) meatHAC(x, order.by = NULL, prewhite = FALSE, weights = weightsAndrews, adjust = TRUE, diagnostics = FALSE, ar.method = "ols", data = list(), ...)

x | a fitted model object. |
---|---|

order.by | Either a vector |

prewhite | logical or integer. Should the estimating functions
be prewhitened? If |

weights | Either a vector of weights for the autocovariances or a
function to compute these weights based on |

adjust | logical. Should a finite sample adjustment be made? This amounts to multiplication with \(n/(n-k)\) where \(n\) is the number of observations and \(k\) the number of estimated parameters. |

diagnostics | logical. Should additional model diagnostics be returned? See below for details. |

sandwich | logical. Should the sandwich estimator be computed?
If set to |

ar.method | character. The |

data | an optional data frame containing the variables in the |

... | arguments passed to |

The function `meatHAC`

is the real work horse for estimating
the meat of HAC sandwich estimators -- the default `vcovHAC`

method
is a wrapper calling
`sandwich`

and `bread`

. See Zeileis (2006) for
more implementation details. The theoretical background, exemplified
for the linear regression model, is described in Zeileis (2004).

Both functions construct weighted information sandwich variance estimators
for parametric models fitted to time series data. These are basically
constructed from weighted sums of autocovariances of the estimating functions
(as extracted by `estfun`

). The crucial step is the specification
of weights: the user can either supply `vcovHAC`

with some vector of
weights or with a function that computes these weights adaptively (based on
the arguments `x`

, `order.by`

, `prewhite`

and `data`

).
Two functions for adaptively choosing weights are implemented in
`weightsAndrews`

implementing the results of Andrews (1991) and
in `weightsLumley`

implementing the results of Lumley (1999).
The functions `kernHAC`

and `weave`

respectively
are to more convenient interfaces for `vcovHAC`

with these functions.

Prewhitening based on VAR approximations is described as suggested in Andrews & Monahan (1992).

The covariance matrix estimators have been improved by the addition of a bias correction and an approximate denominator degrees of freedom for test and confidence interval construction. See Lumley & Heagerty (1999) for details.

A matrix containing the covariance matrix estimate. If `diagnostics`

was set to `TRUE`

this has an attribute `"diagnostics"`

which is a list
with

multiplicative bias correction

Approximate denominator degrees of freedom

Andrews DWK (1991).
“Heteroskedasticity and Autocorrelation Consistent Covariance Matrix Estimation.”
*Econometrica*, **59**, 817--858.

Andrews DWK & Monahan JC (1992).
“An Improved Heteroskedasticity and Autocorrelation Consistent Covariance Matrix Estimator.”
*Econometrica*, **60**, 953--966.

Lumley T & Heagerty P (1999).
“Weighted Empirical Adaptive Variance Estimators for Correlated Data Regression.”
*Journal of the Royal Statistical Society B*, **61**, 459--477.

Newey WK & West KD (1987).
“A Simple, Positive Semi-Definite, Heteroskedasticity and Autocorrelation Consistent Covariance Matrix.”
*Econometrica*, **55**, 703--708.

Zeileis A (2004).
“Econometric Computing with HC and HAC Covariance Matrix Estimators.”
*Journal of Statistical Software*, **11**(10), 1--17.
doi: 10.18637/jss.v011.i10

Zeileis A (2006).
“Object-Oriented Computation of Sandwich Estimators.”
*Journal of Statistical Software*, **16**(9), 1--16.
doi: 10.18637/jss.v016.i09

x <- sin(1:100) y <- 1 + x + rnorm(100) fm <- lm(y ~ x) vcovHAC(fm) #> (Intercept) x #> (Intercept) 0.009716252 0.004740023 #> x 0.004740023 0.023346936 vcov(fm) #> (Intercept) x #> (Intercept) 1.114254e-02 2.818886e-05 #> x 2.818886e-05 2.216611e-02