GLM different results with the same factors

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

GLM different results with the same factors

gaiarrido
I've read something about this problem, but I don't know how can i avoid this problem.
Why the order of the factors give different results? I suppose it's because the order of the factors, i've just changed "lcc" from the first position to the last in the model, and the significance change completely

> modo<-glm(prevalencia~lcc+edadysexo/lcc+edadysexo/mes,binomial)
> anova(modo,test="Chisq")
              Df Deviance Resid. Df Resid. Dev P(>|Chi|)  
NULL                            524     206.97            
lcc            1  10.5715       523     196.40  0.001148 **
edadysexo      2   1.0725       521     195.32  0.584929  
lcc:edadysexo  2   3.7752       519     191.55  0.151433  
edadysexo:mes  9  18.2981       510     173.25  0.031868 *

> mode<-glm(prevalencia~edadysexo/lcc+edadysexo/mes+lcc,binomial)
> anova(mode,test="Chisq")
              Df Deviance Resid. Df Resid. Dev P(>|Chi|)  
NULL                            524     206.97            
edadysexo      2   9.9165       522     197.05  0.007025 **
lcc            1   1.7275       521     195.32  0.188732  
edadysexo:lcc  2   3.7752       519     191.55  0.151433  
edadysexo:mes  9  18.2981       510     173.25  0.031868 *

Ijow can i know what's correct? when i test this two factors separately in a lm (lcc is continuos) and in a chisq.test (edadysexo is categorical) both are significant, and in the model just one of them is significant.

Thanks very much
Mario Garrido Escudero
PhD student
Dpto. de Biología Animal, Ecología, Parasitología, Edafología y Qca. Agrícola
Universidad de Salamanca
Reply | Threaded
Open this post in threaded view
|

Re: GLM different results with the same factors

Mark Difford
On Jul 24, 2011 Gaiarrido wrote:

> Why the order of the factors give different results? I suppose it's because the order of the
> factors, i've just changed "lcc" from the first position to the last in the model, and the significance
> change completely
> ...snip <
> Ijow can i know what's correct?

Both are correct. R's default anova uses sequential sums of squares and so tests model terms sequentially. Reordering the factors in your model therefore leads to different hypotheses being tested. You are looking for what are often called Type II tests. To get them use drop1() on your glm object or install the car package and use its Anova function.

Regards, Mark.
Mark Difford (Ph.D.)
Research Associate
Botany Department
Nelson Mandela Metropolitan University
Port Elizabeth, South Africa
Reply | Threaded
Open this post in threaded view
|

Re: GLM different results with the same factors

gaiarrido
Ok, thanks,
I've been reading these days about what you tell me, but i don't understand properly.
How could I know, with this tests, which variables are significant? I know my dependent variable depends on the lcc and on the edadysexo. but only one per test seems to be significant.

Thanks again
Mario Garrido Escudero
PhD student
Dpto. de Biología Animal, Ecología, Parasitología, Edafología y Qca. Agrícola
Universidad de Salamanca
Reply | Threaded
Open this post in threaded view
|

Re: GLM different results with the same factors

Mark Difford
On Jul 27, 2011 gaiarrido wrote:

> I've been reading these days about what you tell me, but i don't understand properly.
> How could I know, with this tests, which variables are significant?...

Mario,

You need to get in touch with a statistician at your university. You are fitting quite a complex analysis of covariance-type of model. This means (i.e. analysis of covariance) that the influence of edadysexo (your categorical variable) on your response variable is being assessed _after_ adjusting for or taking account of the influence of lcc.

Did you try

##
library(car)
Anova(modo)

as I advised you to?

All I can say for the moment is that you have a significant interaction between edadysexo and mes (I don't know what mes is). Therefore, in general you can't talk about main effects for either. It is also clear that lcc will not be significant when the Type II analysis of variance test that I advised you to do is carried out.
Mark Difford (Ph.D.)
Research Associate
Botany Department
Nelson Mandela Metropolitan University
Port Elizabeth, South Africa
Reply | Threaded
Open this post in threaded view
|

Re: GLM different results with the same factors

gaiarrido
Thanks very much again,
I´m reading some papers and articles about this issue and I think i´m starting to understand the problem.
And thanks for the link to Professor Fox about the non-sequential Anova.

I'll be back with more doubts. I'm sure of that.
Mario Garrido Escudero
PhD student
Dpto. de Biología Animal, Ecología, Parasitología, Edafología y Qca. Agrícola
Universidad de Salamanca