[R] different results depending of variable position.

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Tue Oct 14 14:37:49 CEST 2003


"Ronaldo Reis Jr." <chrysopa at insecta.ufv.br> writes:

> Hi,
> 
> I make an analysis and depending of the order of the variables, the 
> significance change, look.
> 
> m1 <- glm((infec/ntot)~idade+sexo+peso,family=binomial,weights=ntot)
> > anova(m1,test="F")
> Analysis of Deviance Table
> 
> Model: binomial, link: logit
> 
> Response: (infec/ntot)
> 
> Terms added sequentially (first to last)
> 
...
> 
> Why this?

Because terms are added sequentially.  Adding a variable to a model
means different things depending on what else is in the model. Most
textbooks on regression will explain this.

> How the best method to select the model (with idade or without idade)? AIC?

I'd suggest looking at a direct comparison:

m1 <- glm((infec/ntot)~idade+sexo+peso,family=binomial,weights=ntot)
m2 <- glm((infec/ntot)~sexo+peso,family=binomial,weights=ntot)
anova(m1,m2,test="F")

        -p

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list