Hi, I'm working on fitting a glm model to my data using Gamma error structure and reciprocal link. I've been using dropterm (MASS) in the model simplification process, but the F values from analysis of deviance tables reported by dropterm and anova functions are different - sometimes significantly so. However, the reported residual deviances, degrees of freedom, etc. are not different. I don't know how to calculate F values from deviance tables (and can't seem to find anything suggesting how), and so haven't been able to calculate F for myself to see which is more accurate. Below is an example of the code, and I'm using R version 2.8.0.> model1=glm(diff2^(0.491)~mtype*morder,family=Gamma) > dropterm(model1,test="F")Single term deletions Model: diff2^(0.491) ~ mtype * morder Df Deviance AIC F value Pr(F) 23.181 -16.813 mtype:morder 3 24.729 -13.741 2.0694 0.1096> model2=update(model1,~.-mtype:morder) > anova(model1,model2,test="F")Analysis of Deviance Table Model 1: diff2^(0.491) ~ mtype * morder Model 2: diff2^(0.491) ~ mtype + morder Resid. Df Resid. Dev Df Deviance F Pr(>F) 1 93 23.1814 2 96 24.7288 -3 -1.5475 3.0241 0.03352 * --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 -- View this message in context: http://www.nabble.com/Inconsistency-in-F-values-from-dropterm-and-anova-tp21725668p21725668.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]]
Prof Brian Ripley
2009-Jan-29 15:51 UTC
[R] Inconsistency in F values from dropterm and anova
Perhaps if you followed the posting guide and did not send HTML mail your tables would be readable. But your anova call seems wrong, as you have the models in decreasing not increasing order. The correct result is (computing F test by hand)> 23.1814/93[1] 0.2492624> 1.5475/3[1] 0.5158333> 0.5158333/0.2492624[1] 2.069439 so the incorrect use of anova has given you an invalid result (although I don't see immediately what it has done) On Thu, 29 Jan 2009, IMS wrote:> > Hi, > > I'm working on fitting a glm model to my data using Gamma error structure > and reciprocal link. I've been using dropterm (MASS) in the model > simplification process, but the F values from analysis of deviance tables > reported by dropterm and anova functions are different - sometimes > significantly so. However, the reported residual deviances, degrees of > freedom, etc. are not different. I don't know how to calculate F values > from deviance tables (and can't seem to find anything suggesting how), and > so haven't been able to calculate F for myself to see which is more > accurate. Below is an example of the code, and I'm using R version 2.8.0. > >> model1=glm(diff2^(0.491)~mtype*morder,family=Gamma) >> dropterm(model1,test="F") > Single term deletions > > Model: > diff2^(0.491) ~ mtype * morder > Df Deviance AIC F value Pr(F) > 23.181 -16.813 > mtype:morder 3 24.729 -13.741 2.0694 0.1096 > >> model2=update(model1,~.-mtype:morder) >> anova(model1,model2,test="F") > Analysis of Deviance Table > > Model 1: diff2^(0.491) ~ mtype * morder > Model 2: diff2^(0.491) ~ mtype + morder > Resid. Df Resid. Dev Df Deviance F Pr(>F) > 1 93 23.1814 > 2 96 24.7288 -3 -1.5475 3.0241 0.03352 * > --- > Signif. codes: 0 ???***??? 0.001 ???**??? 0.01 ???*??? 0.05 ???.??? 0.1 ??? ??? 1 > > -- > View this message in context: http://www.nabble.com/Inconsistency-in-F-values-from-dropterm-and-anova-tp21725668p21725668.html > Sent from the R help mailing list archive at Nabble.com. > > [[alternative HTML version deleted]] > >-- 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