[R] glm output for binomial family
Enrico Colosimo
enricoc57 at gmail.com
Tue Jun 8 14:10:22 CEST 2010
Hello,
I am having some trouble running a very simple
example. I am running a logistic regression entering the SAME data set
in two different forms and getting different values for the deviance residual.
Just look with this naive data set:
================================================================
# 1- Entering as a Bernoulli data set
y<-c(1,0,1,1,0)
x<-c(2,2,5,5,8)
ajust1<-glm(y~x,family=binomial(link="logit"))
ajust1
#
Coefficients:
(Intercept) x
1.3107 -0.2017
Degrees of Freedom: 4 Total (i.e. Null); 3 Residual
Null Deviance: 6.73
Residual Deviance: 6.491 AIC: 10.49
#
# 2- Entering as Binomial data set
#
ysim<-c(1,2,0)
ynao<-c(1,0,1)
x<-c(2,5,8)
dados<-cbind(ysim,ynao,x)
dados<-as.data.frame(dados)
attach(dados)
ajust2<-glm(as.matrix(dados[,c(1,2)])~x,family=binomial, data=dados)
summary(ajust2)
#
Coefficients:
(Intercept) x
1.3107 -0.2017
Degrees of Freedom: 2 Total (i.e. Null); 1 Residual
Null Deviance: 3.958
Residual Deviance: 3.718 AIC: 9.104
=================================================================
It seems that there is problem with the first fitting!!!
Best
Enrico Colosimo
Dept Statistics, UFMG
Brazil
More information about the R-help
mailing list