weightsAndrews2(x, bw = bwAndrews2, kernel = c("Quadratic Spectral",
"Truncated", "Bartlett", "Parzen", "Tukey-Hanning"), approx = c("AR(1)",
"ARMA(1,1)"), prewhite = 1, ar.method = "ols", tol = 1e-7, verbose = FALSE)bwAndrews2(x, kernel = c("Quadratic Spectral",
"Truncated", "Bartlett", "Parzen", "Tukey-Hanning"), approx = c("AR(1)",
"ARMA(1,1)"), prewhite = 1, ar.method = "ols")
TRUE
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.weightsAndrews
returns a vector of weights.bwAndrews
returns the selected bandwidth parameter.
weightsAndrews2
and bwAndrews2
are simply modified version of weightsAndrews
and bwAndrews
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. kweights
is the same as the one included in the package sandwich.Andrews DWK (1991), Heteroskedasticity and Autocorrelation Consistent Covariance Matrix Estimation. Econometrica, 59, 817--858.
x <- arima.sim(n=200,list(ordre=c(1,0,1),ar=.9,ma=.4))
y <- 2*x + rnorm(200)
x = cbind(x,y)
w <- weightsAndrews2(x, bw = bwAndrews2, kernel = "Quadratic")
plot(w,type='l')
Run the code above in your browser using DataLab