anova.glm (PR#7624)
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:
summary(glm.D93)$dispersion
[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:
There may be a bug in the anova.glm function.
But not in the one in R!
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.
counts <- c(18,17,15,20,10,20,25,13,12) outcome <- gl(3,1,9) treatment <- gl(3,3) glm.D93 <- glm(counts ~ outcome + treatment, family=poisson()) anova(glm.D93,test="Chisq")
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
anova(glm.D93,test="F")
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
counts <- c(18,17,15,20,10,20,25,13,12) outcome <- factor(rep(1:3,3)) treatment <- factor(rep(1:3,c(3,3,3))) glm.D93 <- glm(counts ~ outcome + treatment, family=poisson()) anova(glm.D93, test="Chisq")
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
anova(glm.D93, test="F")
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
______________________________________________ R-devel@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-devel
Brian D. Ripley, ripley@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