NeweyWest | R Documentation |
A set of functions implementing the Newey & West (1987, 1994) heteroscedasticity and autocorrelation consistent (HAC) covariance matrix estimators.
NeweyWest(x, lag = NULL, order.by = NULL, prewhite = TRUE, adjust = FALSE,
diagnostics = FALSE, sandwich = TRUE, ar.method = "ols", data = list(),
verbose = FALSE)
bwNeweyWest(x, order.by = NULL, kernel = c("Bartlett", "Parzen",
"Quadratic Spectral", "Truncated", "Tukey-Hanning"), weights = NULL,
prewhite = 1, ar.method = "ols", data = list(), ...)
x |
a fitted model object. For |
lag |
integer specifying the maximum lag with positive
weight for the Newey-West estimator. If set to |
order.by |
Either a vector |
prewhite |
logical or integer. Should the estimating functions
be prewhitened? If |
kernel |
a character specifying the kernel used. All kernels used
are described in Andrews (1991). |
adjust |
logical. Should a finite sample adjustment be made?
This amounts to multiplication with |
diagnostics |
logical. Should additional model diagnostics be returned?
See |
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 |
verbose |
logical. Should the lag truncation parameter used be printed? |
weights |
numeric. A vector of weights used for weighting the estimated
coefficients of the approximation model (as specified by |
... |
currently not used. |
NeweyWest
is a convenience interface to vcovHAC
using
Bartlett kernel weights as described in Newey & West (1987, 1994).
The automatic bandwidth selection procedure described in Newey & West (1994)
is used as the default and can also be supplied to kernHAC
for the
Parzen and quadratic spectral kernel. It is implemented in bwNeweyWest
which does not truncate its results - if the results for the Parzen and Bartlett
kernels should be truncated, this has to be applied afterwards. For Bartlett
weights this is implemented in NeweyWest
.
To obtain the estimator described in Newey & West (1987), prewhitening has to be suppressed.
NeweyWest
returns the same type of object as vcovHAC
which is typically just the covariance matrix.
bwNeweyWest
returns the selected bandwidth parameter.
Andrews DWK (1991). “Heteroskedasticity and Autocorrelation Consistent Covariance Matrix Estimation.” Econometrica, 59, 817–858.
Newey WK & West KD (1987). “A Simple, Positive Semi-Definite, Heteroskedasticity and Autocorrelation Consistent Covariance Matrix.” Econometrica, 55, 703–708.
Newey WK & West KD (1994). “Automatic Lag Selection in Covariance Matrix Estimation.” Review of Economic Studies, 61, 631–653.
Zeileis A (2004). “Econometric Computing with HC and HAC Covariance Matrix Estimators.” Journal of Statistical Software, 11(10), 1–17. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v011.i10")}
vcovHAC
, weightsAndrews
,
kernHAC
## fit investment equation
data(Investment)
fm <- lm(RealInv ~ RealGNP + RealInt, data = Investment)
## Newey & West (1994) compute this type of estimator
NeweyWest(fm)
## The Newey & West (1987) estimator requires specification
## of the lag and suppression of prewhitening
NeweyWest(fm, lag = 4, prewhite = FALSE)
## bwNeweyWest() can also be passed to kernHAC(), e.g.
## for the quadratic spectral kernel
kernHAC(fm, bw = bwNeweyWest)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.