[R] Robust standard errors in logistic regression

Frank E Harrell Jr f.harrell at vanderbilt.edu
Wed Jul 5 15:01:06 CEST 2006

Celso Barros wrote:
>      Dear Frank and Achim,
>      Thanks for the help. But I must be doing something wrong. I tried to do
> as you suggested:

You didn't do everything I suggested.  Add x=TRUE, y=TRUE after the 
formula given to lrm.  The output for g will answer your other needs.

>> B11<-lrm(HIGH93~HIEDYRS)
>> g<-robcov(B11)
>        But I got the following message:
> Error in residuals.lrm(fit, type = if (method == "huber") "score" else
> "hscore") :
>         you did not specify y=T in the fit
>        By the way, I was wondering if there is a way to use rlm (from MASS)
> to estimate robust standard errors for logistic regression? I am more
> familiar with rlm than with packages such as sandwich.
>       rlm has the big advantage of having a very friendly output, similar to
> the familiar lm output (for instance, it has a clearly located "standard
> errors" column), and (obviously, due to my poor understanding) I find other
> outputs a little bit confusing.
>         Thanks in advance,
>                                         Celso
> On 7/4/06, Achim Zeileis <Achim.Zeileis at wu-wien.ac.at> wrote:
>> On Tue, 4 Jul 2006 13:14:24 -0300 Celso Barros wrote:
>>> I am trying to get robust standard errors in a logistic regression.
>>> Is there any way to do it, either in car or in MASS?
>> Package sandwich offers various types of sandwich estimators that can
>> also be applied to objects of class "glm", in particular sandwich()
>> which computes the standard Eicker-Huber-White estimate.
>> These robust covariance matrices can be plugged into various inference
>> functions such as linear.hypothesis() in car, or coeftest() and
>> waldtest() in lmtest.
>> See the man pages and package vignettes for examples.
>> Z
>>> Thanks for the help,
>>>                                           Celso

Frank E Harrell Jr   Professor and Chair           School of Medicine
                      Department of Biostatistics   Vanderbilt University

More information about the R-help mailing list