[R] Robust standard errors

John Fox jfox at mcmaster.ca
Mon Mar 24 13:36:47 CET 2003

Dear Nirmala,

The object of the various HCCM estimators is to compute standard errors 
that are approximately correct when the error variance in a linear model 
isn't constant. I don't see the relevance to a logit model. Perhaps you can 
explain further what you have in mind (or perhaps someone else is aware of 
a generalization to GLMs).

A small point: hccm.default isn't meant to be called directly, but rather 
through the generic function hccm. If you look at hccm.default you'll see 
that it's only purpose is to report an error when hccm is called with a 
non-lm object. Since glm objects inherit from lm, hccm.lm would normally be 
called, but would fail for a different reason, reporting that an unweighted 
lm object is required. Perhaps this is why you set weights=NULL in the call 
to glm. Weights in glm, incidentally, refer to so-called prior weights -- 
glm still returns weights from its last iteration. The functions hccm.lm 
and hccm.default are pretty simple, and you could discover all this by 
looking at them.


At 11:36 PM 3/23/2003 -0500, Nirmala Ravishankar wrote:
>I am trying to calculate robust standard errors for a logit model.  I
>installed the package "car" and tried using hccm.default, but that
>required an lm object.  Is there some way to do a similar operation for a
>glm object?
>x <- hccm.default(glm(winner ~ racebl + racehi + raceas + inchi + incmed +
>edhs + edcol + edba + agec1 + agec4 + sex + margin + regla + regbay +
>regsc + libcon+ pdem + poth, data = zol, family = binomial, weights =
>Error in hccm.default(glm(winner ~ racebl + racehi + raceas + inchi +  :
>         requires an lm object
> >

John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada L8S 4M4
email: jfox at mcmaster.ca
phone: 905-525-9140x23604
web: www.socsci.mcmaster.ca/jfox

More information about the R-help mailing list