[R] residuals and glm

Martin Olivier olivier.martin at avignon.inra.fr
Thu Feb 22 13:46:06 CET 2007


Hi all,

I have some problems to compute the residuals from a glm model with
binomial distribution.

Suppose I have the following result :
resfit<-glm(y~x1+x2,weights=we,family=binomial(link="logit"))

Now I would like to obtain the residuals .
the command residuals(resfit) and the vector resfit$residuals give 
different
results, and they do not correspond to residuals E(yi)-yi (that is 
resfit$fitted-resfit$y)

so, I would like to know what formula  is applied to compute these 
residuals.
And moreover,  if I want to compute the standardized residuals, what is the
right command from the glmfit result.
Is it 
(resfit$fitted-resfit$y)/sqrt(1/resfit$prior*resfit$fitt*(1-resfit$fitt)) ??


Thanks for your help,
Olivier.



More information about the R-help mailing list