vcovHAC               package:sandwich               R Documentation

_H_e_t_e_r_o_s_k_e_d_a_s_t_i_c_i_t_y _a_n_d _A_u_t_o_c_o_r_r_e_l_a_t_i_o_n _C_o_n_s_i_s_t_e_n_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:

     Heteroskedasticity and autocorrelation consistent (HAC) estimation
     of the covariance matrix of the coefficient estimates in a
     (generalized) linear regression model.

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

     vcovHAC(x, order.by = NULL, prewhite = FALSE, weights = weightsAndrews,
       adjust = TRUE, diagnostics = FALSE, sandwich = TRUE, ar.method = "ols",
       data = list(), ...)

     meatHAC(x, order.by = NULL, prewhite = FALSE, weights = weightsAndrews,
       adjust = TRUE, diagnostics = FALSE, ar.method = "ols", data = list())

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

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

 weights: Either a vector of weights for the autocovariances or a
          function to compute these weights based on 'x', 'order.by',
          'prewhite', 'ar.method' and 'data'. If 'weights' is a
          function it has to take these arguments. See also details.

  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 below for details.

sandwich: logical. Should the sandwich estimator be computed? If set to
          'FALSE' only the meat matrix is returned.

ar.method: character. The 'method' argument passed to 'ar' for
          prewhitening.

    data: an optional data frame containing the variables in the
          'order.by'  model. By default the variables are taken from
          the environment which 'vcovHAC' is called from.

     ...: arguments passed to 'sandwich'.

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

     The function 'meatHAC' is the real work horse for estimating the
     meat of HAC sandwich estimators - 'vcovHAC' is a wrapper calling
     'sandwich' and 'bread'. See Zeileis (2006) for more implementation
     details. The theoretical background, exemplified for the linear
     regression model, is described in Zeileis (2004).

     Both functions construct weighted information sandwich variance
     estimators for parametric models fitted to time series data. These
     are basically constructed from weighted sums of autocovariances of
     the estimation functions (as extracted by 'estfun'). The crucial
     step is the specification of weights: the user can either supply
     'vcovHAC' with some vector of  weights or with a function that
     computes these weights adaptively (based on the arguments 'x',
     'order.by', 'prewhite' and 'data').  Two functions for adaptively
     choosing weights are implemented in 'weightsAndrews' implementing
     the results of Andrews (1991) and in 'weightsLumley' implementing
     the results of Lumley (1999). The functions 'kernHAC' and 'weave'
     respectively are to more convenient interfaces for 'vcovHAC' with
     these functions.

     Prewhitening based on VAR approximations is described as suggested
     in Andrews & Monahan (1992).

     The covariance matrix estimators have been improved by the
     addition of a bias correction and an approximate denominator
     degrees of freedom for test and confidence interval construction.

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

     A matrix containing the covariance matrix estimate. If
     'diagnostics' was set to 'TRUE' this has an attribute
     '"diagnostics' which is a list  with 

bias.correction: multiplicative bias correction

      df: Approximate denominator degrees of freedom

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

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

     Andrews DWK & Monahan JC (1992), An Improved Heteroskedasticity
     and Autocorrelation Consistent Covariance Matrix Estimatior.
     _Econometrica_, *60*, 953-966.

     Lumley A & Heagerty P (1999), Weighted Empirical Adaptive Variance
     Estimators for Correlated Data Regression. _Journal of the Royal
     Statistical Society B_, *61*, 459-477.

     Newey WK & West KD (1987), A Simple, Positive Semi-Definite,
     Heteroskedasticity and Autocorrelation Consistent Covariance
     Matrix. _Econometrica_, *55*, 703-708.

     Zeileis A (2004), Econometric Computing with HC and HAC Covariance
     Matrix Estimators. _Journal of Statistical Software_, *11*(10),
     1-17. URL <URL: http://www.jstatsoft.org/v11/i10/>.  

     Zeileis A (2006), Object-oriented Computation of Sandwich
     Estimators. _Journal of Statistical Software_, *16*(9), 1-16. URL
     <URL: http://www.jstatsoft.org/v16/i09/>.

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

     'weightsLumley', 'weightsAndrews', 'weave', 'kernHAC'

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

     x <- sin(1:100)
     y <- 1 + x + rnorm(100)
     fm <- lm(y ~ x)
     vcovHAC(fm)
     vcov(fm)

