[6564] in s-news-athena
Deviance tests for glm objects
daemon@ATHENA.MIT.EDU (Petr Smilauer)
Sat Mar 4 04:49:01 1995
Date: Sat, 4 Mar 1995 10:26:19 +0100 (MET)
From: Petr Smilauer <petrsm@entu.cas.cz>
To: s-news@utstat.toronto.edu
Cc: Petr Smilauer <petrsm@baloun.entu.cas.cz>
Dear colleagues,
I was wondering whether someone could give a hint with what seems to
be a problem to me.
Using S-Plus version 3.2, MS Windows brand, say, on sample data
corn.yield and corn.rain:
>glm.0<-glm(corn.yield~+1,poisson)
>glm.1<-glm(corn.yield~corn.rain,poisson)
Now, if I do:
>anova(glm.0,glm.1,test="F")
I get:
...
Terms Resid.Df Resid.Dev Test Df Deviance F Value Pr(F)
1 37 23.22
corn.rain 36 19.68 1 3.544 6.483 0.0153
Note, that I've rounded the figures.
Now, if I do:
>anova(glm.1,test="F")
[where I suppose the object's method anova.glm() is called]
I get something like:
....
Df Deviance Resid.Df Resid.Dev F value Pr(F)
NULL 37 23.22
corn.rain 1 3.544 36 19.68 6.682 0.0139
NOTE, THAT the resid.Dev, deviance difference between the models, res.d.f.
etc are the same but not F value and, hence, Pr(F). Tracing the source
for anova.glm() down, I find it calls (at the end) stat.anova() method,
with third parameter ('scale') being set with expression
deviance.lm(object)/object$df.resid . It seems to me that 'deviance.lm'
(which calculates only sum of squares of residuals) seems to be the
problem.
With the presumption of innocence, I guess I should be wrong, using
an inappropriate function. Sight, using F test here might not be best
pick (well, is NOT) here, but still, the program shouldn't behave so..
Any help is welcome.
Thanks!
Petr Smilauer
Univers.of South Bohemia
Czech Republic
<petrsm@entu.cas.cz>