[R] Incorporating the results of White's HCCM into a linear regression:

Jason Morgan jwm-r-help at skepsi.net
Fri Dec 4 23:09:20 CET 2009


On 2009.12.03 23:52:15, Yoseph Zuback wrote:
> Hi Frank,
> 
> I'm trying to repair heteroscedastic variables using the hccm. A
> statistician in my department gave an incomplete solution that included:
> 
> 
> OLS1$coefficients/(sqrt(hccm(OLS1)))
> 
> Trying to solve my problem I get different results with the method you gave
> me and what I am trying with the code above. Lost.
> 

As Frank mentioned, I think you'll need to be more specific as to what
you are needing to do (e.g., what type of heteroskedasticity you are
trying to correct for). If you simply need the error corrected standard
errors produced by hccm (from the car package), you should do something
like

sqrt(diag(hccm(OLS1))),

which will produce a vector of corrected standard errors for the
covariates included in your model. You can then calculate t-values from
there. But realize that there are 5 different versions of the correction
included in hccm, which may produce slightly different results,
especially in small samples. If you need to correct for other sources of
heteroskedasticity, see Frank's rms package or sandwich.

(And, as Frank says, please include your professional affiliation in
your emails to the list, as is suggested in the posting guide.)

HTH,
~Jason

> 
> 2009/12/2 Frank E Harrell Jr <f.harrell at vanderbilt.edu>
> 
> > Yoseph,
> >
> > What do you mean by 'incorporate into'?  If you mean to update the fit
> > object's variance-covariance matrix, one approach might be
> >
> > require(rms)
> > ols1 <- ols(uer92 ~ ..., x=TRUE, y=TRUE)
> > ols1 <- robcov(ols1)
> > anova(ols1); summary(ols1); ...  # uses 'robust' variances&covariances
> >
> > You can substitute bootcov for robcov to use bootstrap estimates rather
> > than Huber-White sandwich estimates.  Note that coefficients are unchanged.
> >
> > Please provide your affiliation in e-mail postings.
> >
> > Frank
> >
> >
> > Yoseph Zuback wrote:
> >
> >> Using hccm() I got a heteroscedasticity correction factor on the diagonal
> >> of
> >> the return matrix, but I don't know how to incorporate this into my linear
> >> model:
> >>
> >> METHOD 1:
> >>
> >>  OLS1 <- lm(formula=uer92~uer+low2+mlo+spec+degree+hit)
> >>>
> >>
> >> Coefficients:
> >>              Estimate Std. Error t value Pr(>|t|)
> >> (Intercept) -0.0623377  0.0323461  -1.927 0.057217 .
> >> uer          0.2274742  0.0758720   2.998 0.003541 **
> >> low2         0.0276404  0.0375770   0.736 0.463973
> >> mlo          0.1491490  0.0940637   1.586 0.116455
> >> spec        -0.1139978  0.0312223  -3.651 0.000445 ***
> >> degree       0.0014694  0.0005316   2.764 0.006970 **
> >> hit         -0.0164365  0.0186028  -0.884 0.379376
> >>
> >>  hccm(OLS1)
> >>>
> >>              (Intercept)           uer          low2           mlo
> >> spec
> >> (Intercept)  9.057187e-04 -1.330377e-03 -3.486945e-05  2.184561e-04
> >> -4.061445e-04
> >> uer         -1.330377e-03  5.471543e-03  3.513046e-04 -4.294427e-04
> >> 1.629196e-03
> >> low2        -3.486945e-05  3.513046e-04  1.378587e-03  1.241245e-04
> >> -5.026434e-05
> >> mlo          2.184561e-04 -4.294427e-04  1.241245e-04  9.796132e-03
> >> -1.059611e-03
> >> spec        -4.061445e-04  1.629196e-03 -5.026434e-05 -1.059611e-03
> >> 9.777099e-04
> >> degree       9.638288e-07 -2.907824e-05 -1.093692e-05 -1.867397e-05
> >> -8.212461e-06
> >> hit         -3.299600e-04 -2.242984e-04  1.036364e-04 -8.158489e-04
> >> 3.994951e-05
> >>                   degree           hit
> >> (Intercept)  9.638288e-07 -3.299600e-04
> >> uer         -2.907824e-05 -2.242984e-04
> >> low2        -1.093692e-05  1.036364e-04
> >> mlo         -1.867397e-05 -8.158489e-04
> >> spec        -8.212461e-06  3.994951e-05
> >> degree       3.485174e-07  4.256330e-06
> >> hit          4.256330e-06  4.154505e-04
> >>
> >> I have reached my limit of R knowledge, any help is appreciated.
> >>
> >>        [[alternative HTML version deleted]]
> >>
> >> ______________________________________________
> >> R-help at r-project.org mailing list
> >> https://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting guide
> >> http://www.R-project.org/posting-guide.html
> >> and provide commented, minimal, self-contained, reproducible code.
> >>
> >>
> >
> > --
> > Frank E Harrell Jr   Professor and Chair           School of Medicine
> >                     Department of Biostatistics   Vanderbilt University
> >
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Jason W. Morgan
Graduate Student
Department of Political Science
*The Ohio State University*
154 North Oval Mall
Columbus, Ohio 43210




More information about the R-help mailing list