Usage
kernHAC(x, order.by = NULL, prewhite = 1, bw = bwAndrews,
kernel = c("Quadratic Spectral", "Truncated", "Bartlett", "Parzen", "Tukey-Hanning"),
approx = c("AR(1)", "ARMA(1,1)"), adjust = TRUE, diagnostics = FALSE,
sandwich = TRUE, ar.method = "ols", tol = 1e-7, data = list(), verbose = FALSE, ...)weightsAndrews(x, order.by = NULL, bw = bwAndrews,
kernel = c("Quadratic Spectral", "Truncated", "Bartlett", "Parzen", "Tukey-Hanning"),
prewhite = 1, ar.method = "ols", tol = 1e-7, data = list(), verbose = FALSE, ...)
bwAndrews(x, order.by = NULL, kernel = c("Quadratic Spectral", "Truncated",
"Bartlett", "Parzen", "Tukey-Hanning"), approx = c("AR(1)", "ARMA(1,1)"),
weights = NULL, prewhite = 1, ar.method = "ols", data = list(), ...)
Arguments
x
a fitted model object of class "lm" or "glm".
order.by
Either a vector z or a formula with a single explanatory
variable like ~ z. The observations in the model
are ordered by the size of z. If set to NULL (the
default) the observations are assum
prewhite
logical or integer. Should the estimating functions
be prewhitened? If TRUE or greater than 0 a VAR model of
order as.integer(prewhite) is fitted via ar with
method "ols" and demean = F
bw
numeric or a function. The bandwidth of the kernel (corresponds to the
truncation lag). If set to to a function (the default is bwAndrews) it is adaptively
chosen.
kernel
a character specifying the kernel used. All kernels used
are described in Andrews (1991).
approx
a character specifying the approximation method if the
bandwidth bw has to be chosen by bwAndrews.
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 vcovHAC for details. sandwich
logical. Should the sandwich estimator be computed?
If set to FALSE only the middle matrix is returned.
ar.method
character. The method argument passed to
ar for prewhitening (only, not for bandwidth selection). tol
numeric. Weights that exceed tol are used for computing
the covariance matrix, all other weights are treated as 0.
data
an optional data frame containing the variables in the order.by
model. By default the variables are taken from the environment which
the function is called from.
verbose
logical. Should the bandwidth parameter used be
printed?
...
further arguments passed to bwAndrews.
weights
numeric. A vector of weights used for weighting the estimated
coefficients of the approximation model (as specified by approx). By
default all weights are 1 except that for the intercept term (if there is more than
one variable).