gmm (version 1.6-2)

bwWilhelm: Wilhelm (2015) bandwidth selection

Description

It computes the optimal bandwidth for the HAC estimation of the covariance matrix of the moment conditions. The bandwidth was shown by Wilhelm (2005) to be the one that minimizes the MSE of the GMM estimator.

Usage

bwWilhelm(x, order.by = NULL, kernel = c("Quadratic Spectral",
  "Bartlett", "Parzen", "Tukey-Hanning"), approx = c("AR(1)", "ARMA(1,1)"),
  weights = NULL, prewhite = 1, ar.method = "ols", data = list())

Arguments

x

An object of class gmm.

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 assumed to be ordered (e.g., a time series).

kernel

type of kernel used to compute the covariance matrix of the vector of sample moment conditions (see kernHAC for more details)

approx

A character specifying the approximation method if the bandwidth has to be chosen by 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)

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 = FALSE.

ar.method

character. The method argument passed to ar for prewhitening.

data

an optional data frame containing the variables in the 'order.by' model.

Value

The function 'bwWilhelm' returns the optimal bandwidth.

References

Wilhelm, D. (2015), Optimal Bandwidth Selection for Robust Generalized Method of Moments Estimation. Econometric Theory, 31, 1054--1077

Zeileis A (2006), Object-oriented Computation of Sandwich Estimators. Journal of Statistical Software, 16(9), 1--16. URL http://www.jstatsoft.org/v16/i09/.

Examples

Run this code
# NOT RUN {
data(Finance)
f1 <- Finance[1:300, "rm"] 
f2 <- Finance[1:300, "hml"] 
f3 <- Finance[1:300, "smb"] 
y <- Finance[1:300,"WMK"]

## Silly example just to make it over-identified
###############################################
res <- gmm(y ~ f1, ~ f1 + f2 + f3)
summary(res)


## Set the bandwidth using the second step estimate
################################################
bw <- bwWilhelm(res)
res2 <- update(res, bw=bw)
summary(res2)

## Set the bandwidth using the first-step estimate as for bwAndrews
###################################################################
res3 <- gmm(y ~ f1, ~ f1 + f2 + f3, bw=bwWilhelm)
summary(res3)




# }

Run the code above in your browser using DataLab