[R] different F test in drop1 and anova
Tom Van Dooren
vdooren at rulsfb.leidenuniv.nl
Thu Oct 20 20:33:47 CEST 2005
Hi Brian,
well I wanted a test based on quasibinomial...
Does it work like this then?:
x<-gl(3,2)
y<-c(0,1,0,0,1,1)
# quasibinomial models #
########################
qb1<-glm(y~x,quasibinomial)
qb2<-glm(y~1,quasibinomial)
qbdev<-(qb2$dev-qb1$dev)
qbdev # deviance I
qbdev/(qb2$df.res-qb1$df.res)/(qb1$dev /qb1$df.res) # deviance ratio II
qbdev/summary(qb1)$disp # scaled deviance III
qbdev/(qb2$df.res-qb1$df.res)/summary(qb1)$disp # scaled deviance IV
anova(qb2,qb1,test="Chisq") # Chisq test based on I
drop1(qb1,test="F") # F test, based on II
drop1(qb1,test="Chisq") # Chisq test, based on III
anova(qb2,qb1,test="F") # F test, based on IV
# binomial models #
###################
b1<-glm(y~x,binomial)
b2<-glm(y~1,binomial)
bdev<-(b2$dev-b1$dev)
bdev # deviance I
bdev/(b2$df.res-b1$df.res)/(b1$dev /b1$df.res) # deviance ratio II
drop1(b1,test="Chisq") # Chisq test, based on I
anova(b2,b1,test="Chisq") # Chisq test based on I
anova(b2,b1,test="F") # Chisq test, based on I
drop1(b1,test="F") # F test, based on II
Cheers, Tom
PS: thanks Tord ;)
More information about the R-help
mailing list