[R] question about about the drop1

Bill.Venables@csiro.au Bill.Venables at csiro.au
Sat Apr 23 11:10:57 CEST 2005


Ronggui asks:

: -----Original Message-----
: From: r-help-bounces at stat.math.ethz.ch 
: [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of ronggui
: Sent: Saturday, 23 April 2005 5:41 PM
: To: r help
: Subject: [R] question about about the drop1
: 
: 
: the data is :
: > table.8.3<-data.frame(expand.grid( 
: marijuana=factor(c("Yes","No"),levels=c("No","Yes")), 
: cigarette=factor(c("Yes","No"),levels=c("No","Yes")), 
: alcohol=factor(c("Yes","No"),levels=c("No","Yes"))), 
: count=c(911,538,44,456,3,43,2,279))
: 
: > fit3<-glm(count ~ .^3, poisson, table.8.3)
: > sumary(fit3)
: ...
: Residual deviance: -1.5543e-15  on 0  degrees of freedom
: AIC: 65.043
: 
: > drop1(fit3, .~., test="Chisq")

Putting in the dummy formula, ". ~ .", will force inappropriate 
terms (marginal terms) to be dropped from the model.


: Single term deletions
: 
: Model:
: count ~ (marijuana + cigarette + alcohol)^3
:                             Df   Deviance    AIC    LRT   Pr(Chi)    
: <none>                         -1.554e-15  65.04                     
: marijuana                    1     365.78 428.83 365.78 < 2.2e-16 ***
:   ....                             ~~~~~~~~~~~~~~
: marijuana:cigarette:alcohol  1       0.37  63.42   0.37   0.54084    
:                                     ~~~~~~~~~~~~~
: 
: > update(fit3,.~.-marijuana )
: ...
: Residual Deviance: -1.188e-13   AIC: 65.04
:                    ~~~~~~~~~~~~~~~~~~~~~~~~~    

Yes. This is the same as the full model, indicating that
the update has not changed the model at all.  You still
have higher order interactions in the model so the main
effect term has to be left in (or it's equivalent).


               
: 
: >update(fit3,.~.-marijuana:cigarette:alcohol )
:  ...
: Residual Deviance: 0.374        AIC: 63.42 
:                    ~~~~~~~~~~~~~~~~~~~~~~~~~


This update has removed the only non-marginal term from the 
model and so has made a change.  This is why you are seeing
the same deviance and AIC here as you saw with drop1.  (This
line from drop1 was the only appropriate one to be shown.)


: 
: i find 0.374 and 63.42 are equal the result from drop1,but   
: "Residual Deviance: -1.188e-13   AIC: 65.04   " is not.
: 
: so i wonder why? what does the drop1 work exactly?

If you tried

drop1(fit3, test = "Chisq")

at the initial stage you would have only seen the three-way
interaction.  The other terms you are seeing with your
inappropriate invocation of drop1 are not what you think
they are.

: 
: thank you !
: 
: ______________________________________________
: R-help at stat.math.ethz.ch mailing list
: https://stat.ethz.ch/mailman/listinfo/r-help
: PLEASE do read the posting guide! 
: http://www.R-project.org/posting-guide.html
:




More information about the R-help mailing list