[R-br] Dúvida contrastes glm binomial

Alexandre dos Santos alexandresantosbr em yahoo.com.br
Segunda Abril 25 15:52:28 BRT 2011


Boa tarde pessoal,

 

        Tenho uma váriavel resposta binomial chamada Infestação (1 presença
e 0 ausência de insetos) e dois fatores qualitativos que são vegetação
(pastagem e floresta) e altitude (alta e baixa), além de parcelle que são as
repetições no campo. Gostaria de fazer contrastes utilizando glm
(family=binomial), então primeiro eu fiz:

 

> m.full<-glm(Infestacao~Altitude*Vegetation*Parcelle, data=H.termes,
family="binomial")# Modelo completo

Mensagens de aviso perdidas:

In model.matrix.default(mt, mf, contrasts) :

  variable 'Altitude' converted to a factor

 

Já fiquei preocupado com essa mensagem, mais de qualquer maneira Altitude é
um fator mesmo, então fiz:

 

> summary(m.full)

 

Call:

glm(formula = Infestacao ~ Altitude * Vegetation * Parcelle, 

    family = "binomial", data = H.termes)

 

Deviance Residuals: 

    Min       1Q   Median       3Q      Max  

-1.0793  -0.4643  -0.4542  -0.2530   2.6296  

 

Coefficients:

                                        Estimate Std. Error z value Pr(>|z|)


(Intercept)                              -3.2454     0.6030  -5.382 7.36e-08
***

Altitudebaixa                             3.0243     0.6322   4.784 1.72e-06
***

Vegetationpature                          0.9997     0.9678   1.033  0.30161


Parcelle                                  0.5115     0.2564   1.995  0.04602
*  

Altitudebaixa:Vegetationpature           -3.0214     1.0505  -2.876  0.00403
** 

Altitudebaixa:Parcelle                   -0.5256     0.2669  -1.969  0.04893
*  

Vegetationpature:Parcelle                -0.9048     0.4561  -1.984  0.04729
*  

Altitudebaixa:Vegetationpature:Parcelle   0.9421     0.5024   1.875  0.06073
.  

---

Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

 

(Dispersion parameter for binomial family taken to be 1)

 

    Null deviance: 1578.6  on 1532  degrees of freedom

Residual deviance: 1317.2  on 1525  degrees of freedom

AIC: 1333.2

 

Number of Fisher Scoring iterations: 5

 

Não tem superdispersão então fiz uma anova:

 

> anova(m.full,test="Chi")

Analysis of Deviance Table

 

Model: binomial, link: logit

 

Response: Infestacao

 

Terms added sequentially (first to last)

 

 

                             Df Deviance Resid. Df Resid. Dev P(>|Chi|)    

NULL                                          1532     1578.6              

Altitude                      1   94.613      1531     1484.0   < 2e-16 ***

Vegetation                    1  154.761      1530     1329.2   < 2e-16 ***

Parcelle                      1    0.248      1529     1329.0   0.61866    

Altitude:Vegetation           1    6.511      1528     1322.5   0.01072 *  

Altitude:Parcelle             1    1.195      1527     1321.3   0.27440    

Vegetation:Parcelle           1    0.491      1526     1320.8   0.48328    

Altitude:Vegetation:Parcelle  1    3.577      1525     1317.2   0.05857 .  

---

Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

Mensagens de aviso perdidas:

In model.matrix.default(object, data = list(Infestacao = c(0, 0,  :

  variable 'Altitude' converted to a factor

 

Então fui reduzindo o modelo ate restarem as variáveis significativas,
sendo:

 

> anova(m3,test="Chi")

Analysis of Deviance Table

 

Model: binomial, link: logit

 

Response: Infestacao

 

Terms added sequentially (first to last)

 

 

                    Df Deviance Resid. Df Resid. Dev P(>|Chi|)    

NULL                                 1532     1578.6              

Altitude             1   94.613      1531     1484.0   < 2e-16 ***

Vegetation           1  154.761      1530     1329.2   < 2e-16 ***

Parcelle             1    0.248      1529     1329.0   0.61866    

Altitude:Vegetation  1    6.511      1528     1322.5   0.01072 *  

---

Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

Mensagens de aviso perdidas:

In model.matrix.default(object, data = list(Infestacao = c(0, 0,  :

  variable 'Altitude' converted to a factor

> summary(m3) 

 

Call:

glm(formula = Infestacao ~ Altitude + Vegetation + Parcelle + 

    Altitude:Vegetation, family = "binomial", data = H.termes)

 

Deviance Residuals: 

    Min       1Q   Median       3Q      Max  

-1.0824  -0.4636  -0.4554  -0.3072   2.4807  

 

Coefficients:

                               Estimate Std. Error z value Pr(>|z|)    

(Intercept)                    -2.20627    0.23768  -9.283  < 2e-16 ***

Altitudebaixa                   1.91926    0.21846   8.785  < 2e-16 ***

Vegetationpature               -0.83836    0.36768  -2.280  0.02260 *  

Parcelle                        0.01484    0.06585   0.225  0.82173    

Altitudebaixa:Vegetationpature -1.10337    0.41007  -2.691  0.00713 ** 

---

Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

 

(Dispersion parameter for binomial family taken to be 1)

 

    Null deviance: 1578.6  on 1532  degrees of freedom

Residual deviance: 1322.5  on 1528  degrees of freedom

AIC: 1332.5

 

Number of Fisher Scoring iterations: 5

 

 

  Então posso deduzir, se é que agora fiz tudo certo, que a variável
resposta é diferente entre altitude alta e baixa e entre vegetação de
pastagem e floresta,  agora gostaria de comparar altitude alta com as
diferentes vegetações, só que não entendi porque a análise separou
Vegetationbaixa e Vegetationpaturage e também não sei que fator a análise
fixou no intercepto,

Alguém saberia me explicar o que posso estar fazendo de errado,

Obrigado,

 

 

 

 

 

Alexandre dos Santos

Ingenieur forestier, Msc.

INRA- Biostatistique et Processus Spatiaux (BioSP)

Domaine Saint-Paul
Site Agroparc 
84914 -  Avignon - France
Tél. : +33 (0)6 87 95 16 29

 

-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://listas.inf.ufpr.br/pipermail/r-br/attachments/20110425/ebebf204/attachment.html>


Mais detalhes sobre a lista de discussão R-br