From ripley@stats.ox.ac.uk  Thu Jul 18 08:14:38 2002
From: ripley@stats.ox.ac.uk (ripley@stats.ox.ac.uk)
Date: Thu, 18 Jul 2002 09:14:38 +0200 (MET DST)
Subject: Fault in anova.glm (PR#1807)
Message-ID: <200207180714.JAA17024@pubhealth.ku.dk>

Fixed now, thanks.

On Thu, 18 Jul 2002 Bill.Venables@cmis.csiro.au wrote:

> When anova.glm is given several models to compare it ignores any prescribed
> dispersion parameter.
>
> An example:
>
>
> > library (MASS)
> > cond1 <- c(20, 50, 3, 9, 15, 20)
> > cond2 <- c(18, 32, 44, 180, 25, 17)
> > cond3 <- c(4, 11, 12, 44, 15, 6)
> > testData <- data.frame(res = c(cond1, cond2, cond3),
> +        conditions = factor(rep(1:3, c(6,6,6))))
> > fm <- glm( res ~ conditions, family = negative.binomial(theta = 1),
> testData)
> > fm0 <- update(fm, .~1)
> > anova(fm0, fm, test="Chisq", dispersion = 1)
> Analysis of Deviance Table
>
> Model 1: res ~ 1
> Model 2: res ~ conditions
>   Resid. Df Resid. Dev Df Deviance P(>|Chi|)
> 1        17    16.8979
> 2        15    11.6307  2   5.2672    0.0668
>
> On the other hand:
>
> > 1 - pchisq(5.2672, 2)
> [1] 0.07181945
> >
>
> The fix:
>
> Replace line 16 of anova.glm:
>
>         return(anova.glmlist(c(list(object), dotargs), test = test))
>
> by
>
> 	return(anova.glmlist(c(list(object), dotargs),
> 		dispersion = dispersion, test = test))
>
>
> --please do not edit the information below--
>
> Version:
>  platform = i386-pc-mingw32
>  arch = i386
>  os = mingw32
>  system = i386, mingw32
>  status =
>  major = 1
>  minor = 5.1
>  year = 2002
>  month = 06
>  day = 17
>  language = R
>
> Windows 2000 Professional (build 2195) Service Pack 1.0
>
> Search Path:
>  .GlobalEnv, package:MASS, package:ctest, Autoloads, package:base
>
> Bill Venables,
> CMIS, CSIRO Marine Laboratories,
> PO Box 120, Cleveland, Qld. 4163
> AUSTRALIA
> Phone:  +61 7 3826 7251
> Fax:    +61 7 3826 7304
> Mobile: +61 419 634 642
> <mailto: Bill.Venables@csiro.au>
> http://www.cmis.csiro.au/bill.venables/
>
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-devel 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-devel-request@stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>

-- 
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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


Fault in anova.glm (PR#1807)
ripley@stats.ox.ac.uk