Hi All,
Can anybody explain why the following three ways of extracting residuals
from a glm object are giving me different outputs:
> idv = runif(1000,0,1)
> dv = rbinom(1000,1,0.5)
> d = data.frame(idv,dv)
> fit = glm(dv~idv, data=d, family=binomial)
> head(residuals(fit))
1 2 3 4 5 6
1.216862 -1.161059 -1.156795 1.204759 -1.141068 1.201437
> head(fit$residuals)
1 2 3 4 5 6
2.096724 -1.962126 -1.952454 2.066224 -1.917492 2.057981
> head(d$dv-fit$fitted.values)
1 2 3 4 5 6
0.5230655 -0.4903489 -0.4878241 0.5160253 -0.4784855 0.5140869
Regards
Utkarsh
______________________________________________
R-help@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.