[R] f-test, binomial, anova
Andrew Beckerman
a.p.beckerman at stir.ac.uk
Thu Sep 12 18:12:52 CEST 2002
Dear all - i think I answered my question:
If i had correctly specified glm(..., family = quasibinomial), anova()
presents the F-test properly when requested. Venables' and Ripley's MASS
library dropterm() seems to be able to pass the F-test through to a model
that was specified as glm(...,family=binomial), which is kind of nice.
cheers
andrew
At 13:55 12/09/02 +0100, Andrew Beckerman wrote:
>Hi there -
>
>I am using R1.5.1 on WinNT and the latest MASS (Venables and Ripley) library.
>
>Running the following code:
>
> >minimod<-glm(miniSF~gtbt*f.batch+log(mxjd),data=gtbt,family="binomial")
>
> >summary(minimod,cor=F)
>Coefficients:
> Estimate Std. Error z value Pr(>|z|)
>(Intercept) 0.91561 0.32655 2.804 0.005049 **
>gtbtgt 0.47171 0.23614 1.998 0.045766 *
>f.batch2 0.48332 0.31159 1.551 0.120866
>log(mxjd) -0.26675 0.06889 -3.872 0.000108 ***
>gtbtgt:f.batch2 -0.92483 0.37244 -2.483 0.013023 *
>---
>Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1
>
>(Dispersion parameter for binomial family taken to be 1)
>
> Null deviance: 4117.4 on 14 degrees of freedom
>Residual deviance: 4053.1 on 10 degrees of freedom
>AIC: 4131.3
>
> >anova(minimod,test="Chisq")
> >anova(minimod,test="F")
> >dropterm(minimod,test="Chisq")
> >dropterm(minimod,test="F")
>
>produces the following, suggesting that the anova function does not deal
>with the F-test for quasibinomial family.... should it or is dropterm()
>doing something odd?
>
>cheers,
>andrew
>
> > anova(minimod,test="Chisq")
>Analysis of Deviance Table
>
>---
>Terms added sequentially (first to last)
>
>
> Df Deviance Resid. Df Resid. Dev P(>|Chi|)
>NULL 14 4117.4
>gtbt 1 40.3 13 4077.1 2.225e-10
>f.batch 1 8.5 12 4068.6 3.541e-03
>log(mxjd) 1 9.4 11 4059.3 2.217e-03
>gtbt:f.batch 1 6.2 10 4053.1 1.301e-02
> > anova(minimod,test="F")
>
>Analysis of Deviance Table
>---
>Terms added sequentially (first to last)
>
>
> Df Deviance Resid. Df Resid. Dev F Pr(>F)
>NULL 14 4117.4
>gtbt 1 40.3 13 4077.1 40.2588 2.225e-10 ***
>f.batch 1 8.5 12 4068.6 8.5053 0.003541 **
>log(mxjd) 1 9.4 11 4059.3 9.3605 0.002217 **
>gtbt:f.batch 1 6.2 10 4053.1 6.1678 0.013009 *
>---
>Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1
> > dropterm(minimod,test="Chisq")
>Single term deletions
>
>Model:
>miniSF ~ gtbt * f.batch + log(mxjd)
> Df Deviance AIC LRT Pr(Chi)
><none> 4053.1 4131.3
>log(mxjd) 1 4068.0 4144.2 14.9 0.0001139 ***
>gtbt:f.batch 1 4059.3 4135.4 6.2 0.0130093 *
>---
>Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1
> > dropterm(minimod,test="F")
>Single term deletions
>
>Model:
>miniSF ~ gtbt * f.batch + log(mxjd)
> Df Deviance AIC F value Pr(F)
><none> 4053.1 4131.3
>log(mxjd) 1 4068.0 4144.2 0.0367 0.8518
>gtbt:f.batch 1 4059.3 4135.4 0.0152 0.9043
>Warning message:
>F test assumes quasibinomial family in: dropterm.glm(minimod, test = "F")
>----------------------------------------------------------
>Dr. Andrew Beckerman
>Institute of Biological Science
>University of Stirling
>Stirling FK9 4LA
>+44 (0)1786 then wk-467808 fx-464994
>(APB is not responsible for anything below this)
>
>--
>The University of Stirling is a university established in Scotland by
>charter at Stirling, FK9 4LA. Privileged/Confidential Information may
>be contained in this message. If you are not the addressee indicated
>in this message (or responsible for delivery of the message to such
>person), you may not disclose, copy or deliver this message to anyone
>and any action taken or omitted to be taken in reliance on it, is
>prohibited and may be unlawful. In such case, you should destroy this
>message and kindly notify the sender by reply email. Please advise
>immediately if you or your employer do not consent to Internet email
>for messages of this kind. Opinions, conclusions and other
>information in this message that do not relate to the official
>business of the University of Stirling shall be understood as neither
>given nor endorsed by it.
>
>-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
>r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
>Send "info", "help", or "[un]subscribe"
>(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
>_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
----------------------------------------------------------
Dr. Andrew Beckerman
Institute of Biological Science
University of Stirling
Stirling FK9 4LA
+44 (0)1786 then wk-467808 fx-464994
(APB is not responsible for anything below this)
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list