HAC(x, weights = weightsAndrews2, bw = bwAndrews2, prewhite = FALSE, ar.method = "ols",
kernel=c("Quadratic Spectral", "Truncated", "Bartlett", "Parzen", "Tukey-Hanning"),
approx="AR(1)",tol = 1e-7)
bwAndrews2
which is proposed by Andrews (1991). The alternative is bwNeweyWest2
of NeTRUE
or greater than 0 a VAR model of
order as.integer(prewhite)
is fitted via ar
with
method "ols"
and demean = F
method
argument passed to
ar
for prewhitening.bwAndrews2
.tol
are used for computing the covariance matrix, all other weights are treated as 0.HAC
is simply a modified version of meatHAC
from the package sandwich. The modifications have been made so that the argument x can be a matrix instead of an object of class lm or glm. The details on how is works can be found on the sandwich manual.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.
x <- arima.sim(n=200,list(order=c(1,0,1),ar=.5,ma=.3,sd=.5))
y <- .4*x+rnorm(200)
x <- cbind(x,y)
vcov <- HAC(x)
Run the code above in your browser using DataLab