[R] different F test in drop1 and anova
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu Oct 20 23:12:09 CEST 2005
Yes, in essence although it is much easier to describe in words.
anova uses the Chisquared-based estimate of dispersion unless it is known.
drop1 uses the deviance-based estimate of dispersion unless it is known.
If the F tests are going to be approximately valid the dispersion
estimators should be pretty similar, and when they are not the first _may_
be closer to chi-square-distributed. However, as I recall it, when I
learnt analysis of deviance using GLIM3, the drop1 approach was used.
On Thu, 20 Oct 2005, Tom Van Dooren wrote:
> 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 ;)
>
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list