[R] Incorporating the results of White's HCCM into a linear regression:
Frank E Harrell Jr
f.harrell at vanderbilt.edu
Wed Dec 2 14:00:12 CET 2009
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
More information about the R-help
mailing list