s-news
[Top] [All Lists]

Re: anova and addterm with F-tests in a Poisson GLM

To: Tom Charman <tgc21@cam.ac.uk>
Subject: Re: anova and addterm with F-tests in a Poisson GLM
From: james.king@ey.com
Date: Fri, 14 May 2004 10:58:49 -0400
Cc: s-news@lists.biostat.wustl.edu

Phone:    212-773-4224
FAX:        212-773-8477
email:       James.King@ey.com
EYcomm: 6955466


The F statistics are different because addterm and anova are estimating the scale parameter differently.
addterm is using the deviance divided by the residual degrees of freedom but anova is using the sum of
the squares of the standardized residuals divided by the residual degrees of freedom. See Venables &
Ripley pages 186 and 187.


>stat.anova(anova(model1, model2), test = "F", scale = deviance(model2)/model2$
        df.resid, model2$df.resid, 10)[, 6:8]
Analysis of Deviance Table

Response: bees

  Deviance  F Value     Pr(F)
1                            
2 3.393755 2.417303 0.1586095

>stat.anova(anova(model1, model2), test = "F", scale = sum(residuals(model2,
        type = "pearson")^2)/model2$df.resid, model2$df.resid, 10)[, 6:8]
Analysis of Deviance Table

Response: bees

  Deviance  F Value     Pr(F)
1                            
2 3.393755 2.201395 0.1761781


Note dropterm gives an error for this

>dropterm(model2,test="F")
Problem in ||: No data to interpret as logical value: e1 || e2
Evaluation frames saved in object "last.dump", use debugger() to examine them




Tom Charman <tgc21@cam.ac.uk>
Sent by: s-news-owner@lists.biostat.wustl.edu

05/14/2004 06:34 AM

       
        To:        s-news@lists.biostat.wustl.edu
        cc:        
        Subject:        [S] anova and addterm with F-tests in a Poisson GLM




Hi S-listers,

I am looking into the effects of some environmental conditions
(temperature, wind speed, etc) on the foraging activity of bumblebees. I'm
trying to do this using a Poisson GLM with count of foraging bumblebees as
the response and the different environmental conditions as explanatory
variables. I have been looking at each environmental condition by adding it
to a minimal model and testing the change in deviance with an F-test (the
data is slightly over-dispersed). Recently I stumbled on Venables &
Ripley's cunning addterm function in their MASS library which would save me
a lot of time. Unfortunately I get slightly different F and P values when I
do the test using anova (model1, model2, test = "F") and addterm (model1,
model2, test = "F"). The deviances are the same using both methods, its
just the F and P values that differ. I'm not sure what I'm doing wrong, or
if I've got the wrong idea about these functions, and would be really
grateful if anyone could give me a clue.

Thanks loads,
tom

A madeup example of what I'm doing:
> bees<- c(6, 8, 10, 8, 14, 3, 6, 5, 12, 4) temp<-
> factor(c("hot","hot","hot","hot","hot","cold","cold","cold","cold","cold")
> ) model1<- glm(bees ~ 1, family = poisson) model2<- glm(bees ~ temp,
> family = poisson) library (MASS) anova (model1, model2, test = "F")
Analysis of Deviance Table

Response: bees

 Terms Resid. Df Resid. Dev Test Df Deviance  F Value     Pr(F)
1     1         9   14.62530                                    
2  temp         8   11.23154       1 3.393755 2.201395 0.1761781

> addterm (model1, model2, test = "F")
Single term additions

Model:
bees ~ 1
      Df Deviance      AIC  F value     Pr(F)
<none>    14.62530 16.62530                  
 temp  1 11.23154 15.23154 2.417303 0.1586095
>

--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu.  To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message:  unsubscribe s-news


________________________________________________________________________
The information contained in this message may be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer.

Notice required by law: This e-mail may constitute an advertisement or solicitation under U.S. law, if its primary purpose is to advertise or promote a commercial product or service. You may choose not to receive advertising and promotional messages from Ernst & Young LLP (except for Ernst & Young Online and the ey.com website, which track e-mail preferences through a separate process) at this e-mail address by forwarding this message to no-more-mail@ey.com. If you do so, the sender of this message will be notified promptly. Our principal postal address is 5 Times Square, New York, NY 10036. Thank you. Ernst & Young LLP
<Prev in Thread] Current Thread [Next in Thread>