Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

getBandwidth

Automatic Bandwidth Selection


Description

Automatic bandwidth selection of Andrews (1991) and of Newey and West (1994).

Usage

getBandwidth(u, bandwidth = c("and", "nw"), kernel, ..., check = TRUE)

getBandwidthAnd(u, kernel = c("ba", "pa", "qs", "th", "tr"), check = TRUE)

getBandwidthNW(u, kernel = c("ba", "pa", "qs"), inter = FALSE,
  u.weights = NULL, check = TRUE)

Arguments

u

[numeric]
Data on which to apply the bandwidth selction.

bandwidth

[character(1)]
The bandwidth selection method to use. Default is Andrews (1991) ("and"), an alternative is Newey West (1994) ("nw").

kernel

[character(1)]
The kernel function to use for selecting the bandwidth. Default is Bartlett kernel ("ba"), see Details for alternatives.

...

Arguments passed to getBandwidthNW.

check

[logical]
Wheather to check (and if necessary convert) the arguments. See checkVars for further information.

inter

[logical]
The first column will be ignored, if TRUE (intercept). Default is FALSE.

u.weights

[numeric]
How to weight the columns of u. If NULL (default), uses identical weights for all columns.

Details

For Andrews (1991), the AR(1) individual version is implemented.

The kernel that is used for calculating the long-run variance can be one of the following:

  • "ba": Bartlett kernel

  • "pa": Parzen kernel

  • "qs": Quadratic Spectral kernel

  • "th": Tukey-Hanning kernel (only if bandwidth = "and")

  • "tr": Truncated kernel (only if bandwidth = "and")

Value

[numeric(1)]. Bandwidth

Functions

  • getBandwidthAnd: Automatic bandwidth selection of Andrews (1991).

  • getBandwidthNW: Automatic bandwidth selection of Newey and West (1994).

References

  • Andrews, D.W.K. (1991): "Heteroskedasticity and Autocorrelation Consistent Covariance Matrix Estimation," Econometrica, 59, 817–854, DOI:10.2307/2938229.

  • Newey, W.K. and K.D. West (1994): "Automatic Lag Selection in Covariance Matrix Estimation", Review of Economic Studies, 61, 631–653, DOI:10.2307/2297912.

See Also

Examples

set.seed(1909)
x <- rnorm(100)
getBandwidth(x, kernel = "ba")
getBandwidth(x, bandwidth = "nw", kernel = "ba")

x2 <- arima.sim(model = list(ar = c(0.7, 0.2)), innov = x, n = 100)
getBandwidth(x2, kernel = "qs")
getBandwidth(x2, bandwidth = "nw", kernel = "qs")

cointReg

Parameter Estimation and Inference in a Cointegrating Regression

v0.2.0
GPL-3
Authors
Philipp Aschersleben [aut, cre], Martin Wagner [aut] (Author of underlying MATLAB code.)
Initial release
2016-06-14

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.