NeweyWest              package:sandwich              R Documentation

_N_e_w_e_y-_W_e_s_t _H_A_C _C_o_v_a_r_i_a_n_c_e _M_a_t_r_i_x _E_s_t_i_m_a_t_i_o_n

_D_e_s_c_r_i_p_t_i_o_n:

     A set of functions implementing the Newey & West (1987, 1994)
     heteroskedasticity and autocorrelation consistent (HAC) covariance
     matrix estimators.

_U_s_a_g_e:

     NeweyWest(x, lag = NULL, order.by = NULL, prewhite = TRUE, adjust = FALSE, 
       diagnostics = FALSE, sandwich = TRUE, ar.method = "ols", data = list(),
       verbose = FALSE)

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

_A_r_g_u_m_e_n_t_s:

       x: a fitted model object of class '"lm"' or '"glm"'.

     lag: integer specifying the maximum lag with positive  weight for
          the Newey-West estimator. If set to 'NULL'
          'floor(bwNeweyWest(x, ...))' is used.

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).

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'. The default is to use VAR(1)
          prewhitening.

  kernel: a character specifying the kernel used. All kernels used are
          described in Andrews (1991). 'bwNeweyWest' can only compute
          bandwidths for '"Bartlett"', '"Parzen"' and '"Quadratic
          Spectral"'.

  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).

    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 lag truncation parameter used be printed?

 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).

     ...: currently not used.

_D_e_t_a_i_l_s:

     'NeweyWest' is a convenience interface to 'vcovHAC' using 
     Bartlett kernel weights as described in Newey & West (1987, 1994).
     The automatic bandwidth selection procedure described in Newey &
     West (1994) is used as the default and can also be supplied to
     'kernHAC' for the Parzen and quadratic spectral kernel. It is
     implemented in 'bwNeweyWest' which does not truncate its results -
     if the results for the Parzen and Bartlett kernels should be
     truncated, this has to be applied afterwards. For Bartlett 
     weights this is implemented in 'NeweyWest'.

     To obtain the estimator described in Newey & West (1987),
     prewhitening has to be suppressed.

_V_a_l_u_e:

     'NeweyWest' returns the same type of object as 'vcovHAC' which is
     typically just the covariance matrix.

     'bwNeweyWest' returns the selected bandwidth parameter.

_R_e_f_e_r_e_n_c_e_s:

     Andrews DWK (1991), Heteroskedasticity and Autocorrelation
     Consistent Covariance Matrix Estimation. _Econometrica_, *59*,
     817-858.

     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.

_S_e_e _A_l_s_o:

     'vcovHAC', 'weightsAndrews', 'kernHAC'

_E_x_a_m_p_l_e_s:

     ## fit investment equation
     data(Investment)
     fm <- lm(RealInv ~ RealGNP + RealInt, data = Investment)

     ## Newey & West (1994) compute this type of estimator
     NeweyWest(fm)

     ## The Newey & West (1987) estimator requires specification
     ## of the lag and suppression of prewhitening
     NeweyWest(fm, lag = 4, prewhite = FALSE)

     ## bwNeweyWest() can also be passed to kernHAC(), e.g.
     ## for the quadratic spectral kernel
     kernHAC(fm, bw = bwNeweyWest)

