Skip to content

anova.glm (PR#7624)

2 messages · yuedong@pstat.ucsb.edu, Brian Ripley

#
There may be a bug in the anova.glm function.

deathstar[32] R

R : Copyright 2004, The R Foundation for Statistical Computing
Version 2.0.1  (2004-11-15), ISBN 3-900051-07-0

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for a HTML browser interface to help.
Type 'q()' to quit R.
Analysis of Deviance Table

Model: poisson, link: log

Response: counts

Terms added sequentially (first to last)


           Df Deviance Resid. Df Resid. Dev P(>|Chi|)
NULL                          8    10.5814
outcome    2   5.4523         6     5.1291    0.0655
treatment  2   0.0000         4     5.1291    1.0000
Analysis of Deviance Table

Model: poisson, link: log

Response: counts

Terms added sequentially (first to last)


           Df Deviance Resid. Df Resid. Dev      F  Pr(>F)
NULL                          8    10.5814
outcome    2   5.4523         6     5.1291 2.7262 0.06547 .
treatment  2   0.0000         4     5.1291 0.0000 1.00000
---
Signif. codes:  0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1



----------------------------------------------------------------------
The F test should use the estimated dispersion parameter, so should be 
different from the Chisq test. The following is what I got from Splus:

deathstar[31] Splus
S-PLUS : Copyright (c) 1988, 2000 MathSoft, Inc.
S : Copyright Lucent Technologies, Inc.
Version 6.0 Release 1 for Linux 2.2.12 : 2000
Working data will be in /data/home/faculty/yuedong/MySwork
Analysis of Deviance Table

Poisson model

Response: counts

Terms added sequentially (first to last)
           Df  Deviance Resid. Df Resid. Dev   Pr(Chi)
      NULL                      8   10.58145
   outcome  2  5.452305         6    5.12914 0.0654707
treatment  2  0.000000         4    5.12914 1.0000000
Analysis of Deviance Table

Poisson model

Response: counts

Terms added sequentially (first to last)
           Df  Deviance Resid. Df Resid. Dev  F Value     Pr(F)
      NULL                      8   10.58145
   outcome  2  5.452305         6    5.12914 2.108359 0.2369863
treatment  2  0.000000         4    5.12914 0.000000 1.0000000


--------------------------------------------------------------------
Yuedong Wang                                  Phone:  (805) 893-4870
Dept of Statistics & Applied Probability        Fax:  (805) 893-2334
Univ of California                            yuedong@pstat.ucsb.edu
Santa Barbara, CA 93106    http://www.pstat.ucsb.edu/faculty/yuedong
#
A poisson family has dispersion 1 by definition of 'Poisson'.
You need a quasipoisson family to use a moment estimate of dispersion.

This difference is described on the help page for anova.glm.
Note the estimated dispersion *is* used and *is* one:
[1] 1

as it ought to be (and is in S-PLUS too).  That it is not used in S-PLUS 
is not documented (and it is not used in summary.glm either) and is at 
least an inconsistency.

Your assumption that R is wrong and S-PLUS (sic) is correct is not 
appreciated.  Why did you file this as an R bug and not an S-PLUS one?
On Wed, 2 Feb 2005 yuedong@pstat.ucsb.edu wrote:

            
But not in the one in R!