vcovHC               package:sandwich               R Documentation

_H_e_t_e_r_o_s_k_e_d_a_s_t_i_c_i_t_y-_C_o_n_s_i_s_t_e_n_t _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-consistent estimation of the covariance matrix
     of the coefficient estimates in regression models.

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

     vcovHC(x,
       type = c("HC3", "const", "HC", "HC0", "HC1", "HC2", "HC4"),
       omega = NULL, sandwich = TRUE, ...)

     meatHC(x, type = , omega = NULL)

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

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

    type: a character string specifying the estimation type. For
          details see below.

   omega: a vector or a function depending on the arguments 'residuals'
          (the residuals of the linear model), 'diaghat' (the diagonal 
          of the corresponding hat matrix) and 'df' (the residual
          degrees of freedom). For details see below.

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

     ...: arguments passed to 'sandwich'.

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

     The function 'meatHC' is the real work horse for estimating the
     meat of HC sandwich estimators - 'vcovHC' 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 below and in Zeileis (2004).

     When 'type = "const"' constant variances are assumed and and
     'vcovHC' gives the usual estimate of the covariance matrix of the
     coefficient estimates:


                          sigma^2 (X'X)^{-1}


     All other methods do not assume constant variances and are
     suitable in case of heteroskedasticity. '"HC"' (or equivalently
     '"HC0"') gives White's estimator, the other estimators are
     refinements of this. They are all of form


                   (X'X)^{-1} X' Omega X (X'X)^{-1}


     and differ in the choice of Omega. This is in all cases a diagonal
     matrix whose  elements can be either supplied as a vector 'omega'
     or as a a function 'omega' of the residuals, the diagonal elements
     of the hat matrix and the residual degrees of freedom. For White's
     estimator

     'omega <- function(residuals, diaghat, df) residuals^2'

     Instead of specifying of providing the diagonal 'omega' or a
     function for estimating it, the 'type' argument can be used to
     specify the  HC0 to HC4 estimators. If 'omega' is used, 'type' is
     ignored.

     Long & Ervin (2000) conduct a simulation study of HC estimators in
     the linear regression model, recommending to use HC3 which is thus
     the default in 'vcovHC'. Cribari-Neto (2004) suggests the HC4 type
     estimator which is tailored to take into account the effect of
     leverage points in the design matrix. For more details see the
     references.

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

     A matrix containing the covariance matrix estimate.

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

     Cribari-Neto F. (2004), Asymptotic inference under
     heteroskedasticity of unknown form. _Computational Statistics &
     Data Analysis_ *45*, 215-233.

     Long J. S., Ervin L. H. (2000), Using Heteroscedasticity
     Consistent Standard Errors in the Linear Regression Model. _The
     American Statistician_, *54*, 217-224.

     MacKinnon J. G., White H. (1985), Some
     heteroskedasticity-consistent covariance matrix estimators with
     improved finite sample properties. _Journal of Econometrics_ *29*,
     305-325.

     White H. (1980), A heteroskedasticity-consistent covariance matrix
     and a direct test for heteroskedasticity. _Econometrica_ *48*,
     817-838.

     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:

     'lm', 'hccm', 'bptest', 'ncv.test'

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

     ## generate linear regression relationship
     ## with homoskedastic variances
     x <- sin(1:100)
     y <- 1 + x + rnorm(100)
     ## compute usual covariance matrix of coefficient estimates
     fm <- lm(y ~ x)
     vcovHC(fm, type="const")
     vcov(fm)

     sigma2 <- sum(residuals(lm(y~x))^2)/98
     sigma2 * solve(crossprod(cbind(1,x)))

