Infelizmente, estar publicado nao implica em estar correto. Por isso, a importancia do estatistico local.<div class="gmail_extra"><br><br><div class="gmail_quote">2012/11/20 Alexandre Santos <span dir="ltr"><<a href="mailto:alexandresantosbr@yahoo.com.br" target="_blank">alexandresantosbr@yahoo.com.br</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-size:10pt;font-family:arial,helvetica,sans-serif"><div align="center" style="font-family:arial,helvetica,sans-serif;font-size:10pt;text-align:left">
<span style="background-color:transparent">Obrigado Benilton,</span></div><div align="center" style="font-family:arial,helvetica,sans-serif;font-size:10pt;text-align:left"><span style="background-color:transparent"><br></span></div>
<div align="center" style="font-family:arial,helvetica,sans-serif;font-size:10pt;text-align:left"><span style="background-color:transparent"> Mas o modelo parece estar correto, estou seguindo a metodologia empregada por Farhad et al. 2011 pag 2., Equação 1. (Foraging behavior of Praon Volucre .... doi: 10.1155/2011/868546).</span></div>
<div align="center" style="font-family:arial,helvetica,sans-serif;font-size:10pt;text-align:left"><span style="background-color:transparent"><br></span></div><div align="center" style="font-family:arial,helvetica,sans-serif;font-size:10pt;text-align:left">
<span style="background-color:transparent"> Achei um erro no meu CMR que ficaria:</span></div><div align="center" style="font-family:arial,helvetica,sans-serif;font-size:10pt;text-align:left"><span style="background-color:transparent"><br>
</span></div><div style="font-style:normal;font-size:13px;background-color:transparent;font-family:arial,helvetica,sans-serif"><div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif"><span style="font-family:arial,helvetica,sans-serif;font-size:13px">> #</span></div>
<div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif"><span style="font-family:arial,helvetica,sans-serif;font-size:13px">> ###################################################################################################</span></div>
<div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif"><span style="font-family:arial,helvetica,sans-serif;font-size:13px">> #Regressão logística entre a proporção de herbivoros predados e a densidade de herbivoros oferecidos</span></div>
<div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif"><span style="font-family:arial,helvetica,sans-serif;font-size:13px">> #</span></div><div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif">
<span style="font-family:arial,helvetica,sans-serif;font-size:13px">> pred<-c(1,2,2,3,1,4,2,3,2,3,5,6,5,5,3,7,7,6,2</span></div><div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif"><span style="font-family:arial,helvetica,sans-serif;font-size:13px">+ ,3,15,12,14,12,11,11,11,13,13,13,18,14,27,26</span></div>
<div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif"><span style="font-family:arial,helvetica,sans-serif;font-size:13px">+ ,17,18,20,22,10,15,29,30,36,40,23,50,30,40,29,52)##Número de herbívoros predados</span></div>
<div class="im"><div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif"><span style="font-family:arial,helvetica,sans-serif;font-size:13px">> dens<-sort(rep(2^(2:6),10))#### Densidade de herbivoros oferecidos</span></div>
<div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif"><span style="font-family:arial,helvetica,sans-serif;font-size:13px">> ##</span></div><div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif">
<span style="font-family:arial,helvetica,sans-serif;font-size:13px">> ##Regressão pred/dens = exp(P0+P1*N+P2*N^2+P3*N3)/1+ exp(P0+P1*N+P2*N^2+P3*N3)</span></div></div><div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif">
<span style="font-family:arial,helvetica,sans-serif;font-size:13px">> p.model1<-glm(pred/dens~dens+I(dens^2)+I(dens^3),family="binomial")</span></div><div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif">
<span style="font-family:arial,helvetica,sans-serif;font-size:13px">Mensagens de aviso perdidas:</span></div><div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif"><span style="font-family:arial,helvetica,sans-serif;font-size:13px">In eval(expr, envir, enclos) : #sucessos não-inteiro em um glm binomial!</span></div>
<div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif"><span style="font-family:arial,helvetica,sans-serif;font-size:13px">> summary(p.model1)</span></div><div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif">
<span style="font-family:arial,helvetica,sans-serif;font-size:13px"><br></span></div><div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif"><span style="font-family:arial,helvetica,sans-serif;font-size:13px">Call:</span></div>
<div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif"><span style="font-family:arial,helvetica,sans-serif;font-size:13px">glm(formula = pred/dens ~ dens + I(dens^2) +
I(dens^3), family = "binomial")</span></div><div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif"><span style="font-family:arial,helvetica,sans-serif;font-size:13px"><br></span></div>
<div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif"><span style="font-family:arial,helvetica,sans-serif;font-size:13px">Deviance Residuals: </span></div><div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif">
<span style="font-family:arial,helvetica,sans-serif;font-size:13px"> Min 1Q Median 3Q Max </span></div><div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif"><span style="font-family:arial,helvetica,sans-serif;font-size:13px">-0.85240 -0.17292 -0.05812 0.19453 1.10008 </span></div>
<div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif"><span style="font-family:arial,helvetica,sans-serif;font-size:13px"><br></span></div><div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif">
<span style="font-family:arial,helvetica,sans-serif;font-size:13px">Coefficients:</span></div><div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif"><span style="font-family:arial,helvetica,sans-serif;font-size:13px"> Estimate Std. Error z value Pr(>|z|)</span></div>
<div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif"><span style="font-family:arial,helvetica,sans-serif;font-size:13px">(Intercept) -5.744e-01 1.231e+00 -0.467 0.641</span></div><div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif">
<span style="font-family:arial,helvetica,sans-serif;font-size:13px">dens 2.238e-01 2.244e-01 0.997 0.319</span></div><div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif"><span style="font-family:arial,helvetica,sans-serif;font-size:13px">I(dens^2) -8.846e-03 9.018e-03 -0.981 0.327</span></div>
<div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif"><span style="font-family:arial,helvetica,sans-serif;font-size:13px">I(dens^3) 8.671e-05 9.154e-05 0.947
0.344</span></div><div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif"><span style="font-family:arial,helvetica,sans-serif;font-size:13px"><br></span></div><div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif">
<span style="font-family:arial,helvetica,sans-serif;font-size:13px">(Dispersion parameter for binomial family taken to be 1)</span></div><div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif">
<span style="font-family:arial,helvetica,sans-serif;font-size:13px"><br></span></div><div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif"><span style="font-family:arial,helvetica,sans-serif;font-size:13px"> Null deviance: 8.1347 on 49 degrees of
freedom</span></div><div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif"><span style="font-family:arial,helvetica,sans-serif;font-size:13px">Residual deviance: 6.8751 on 46 degrees of freedom</span></div>
<div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif"><span style="font-family:arial,helvetica,sans-serif;font-size:13px">AIC: 67.087</span></div><div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif">
<span style="font-family:arial,helvetica,sans-serif;font-size:13px"><br></span></div><div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif"><span style="font-family:arial,helvetica,sans-serif;font-size:13px">Number of Fisher Scoring iterations: 4</span></div>
<div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif"><span style="font-family:arial,helvetica,sans-serif;font-size:13px"><br></span></div><div style="font-style:normal;font-size:13px;font-family:arial,helvetica,sans-serif">
<span style="font-family:arial,helvetica,sans-serif;font-size:13px">> #</span></div><div style="font-style:normal;font-size:10pt;font-family:arial,helvetica,sans-serif"><br></div><div style="font-style:normal;font-size:10pt;font-family:arial,helvetica,sans-serif">
Mas é exatamente o seu exemplo que eu procurava, pois eu queria os coeficientes de P0, P1, P2 e P3, seguindo sua ajuda:</div><div style="font-style:normal;font-size:10pt;font-family:arial,helvetica,sans-serif"><br></div>
<div>
<div><span style="font-family:arial,helvetica,sans-serif;font-size:13px">>
naoPred<-dens-pred</span></div><div><span style="font-family:arial,helvetica,sans-serif;font-size:13px">> p.model2<-glm(cbind(pred, naoPred)~poly(dens, 3, raw=TRUE), family='binomial')</span></div><div>
<span style="font-family:arial,helvetica,sans-serif;font-size:13px">> summary(p.model2)</span></div><div><span style="font-family:arial,helvetica,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,helvetica,sans-serif;font-size:13px">Call:</span></div>
<div><span style="font-family:arial,helvetica,sans-serif;font-size:13px">glm(formula = cbind(pred, naoPred) ~ poly(dens, 3, raw = TRUE), </span></div><div><span style="font-family:arial,helvetica,sans-serif;font-size:13px"> family = "binomial")</span></div>
<div><span style="font-family:arial,helvetica,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,helvetica,sans-serif;font-size:13px">Deviance Residuals: </span></div><div><span style="font-family:arial,helvetica,sans-serif;font-size:13px"> Min 1Q Median 3Q Max </span></div>
<div><span style="font-family:arial,helvetica,sans-serif;font-size:13px">-3.2393 -0.9997 -0.0732 0.9515 4.2567 </span></div><div><span style="font-family:arial,helvetica,sans-serif;font-size:13px"><br></span></div>
<div><span style="font-family:arial,helvetica,sans-serif;font-size:13px">Coefficients:</span></div><div><span style="font-family:arial,helvetica,sans-serif;font-size:13px"> Estimate Std. Error z value Pr(>|z|) </span></div>
<div><span style="font-family:arial,helvetica,sans-serif;font-size:13px">(Intercept)
-8.399e-01 4.949e-01 -1.697 0.089672 . </span></div><div><span style="font-family:arial,helvetica,sans-serif;font-size:13px">poly(dens, 3, raw = TRUE)1 2.688e-01 7.444e-02 3.611 0.000305 ***</span></div>
<div><span style="font-family:arial,helvetica,sans-serif;font-size:13px">poly(dens, 3, raw = TRUE)2 -1.055e-02 2.755e-03 -3.828 0.000129 ***</span></div><div><span style="font-family:arial,helvetica,sans-serif;font-size:13px">poly(dens, 3, raw = TRUE)3 1.033e-04 2.681e-05 3.853 0.000117 ***</span></div>
<div><span style="font-family:arial,helvetica,sans-serif;font-size:13px">---</span></div><div><span style="font-family:arial,helvetica,sans-serif;font-size:13px">Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 </span></div>
<div><span style="font-family:arial,helvetica,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,helvetica,sans-serif;font-size:13px">(Dispersion parameter for binomial family taken to be 1)</span></div>
<div><span style="font-family:arial,helvetica,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,helvetica,sans-serif;font-size:13px"> Null deviance: 148.29 on 49 degrees of freedom</span></div>
<div><span style="font-family:arial,helvetica,sans-serif;font-size:13px">Residual deviance: 121.77 on 46 degrees of freedom</span></div><div><span style="font-family:arial,helvetica,sans-serif;font-size:13px">AIC: 280.61</span></div>
<div><span style="font-family:arial,helvetica,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,helvetica,sans-serif;font-size:13px">Number of Fisher Scoring iterations: 4</span></div><div><span style="font-family:arial,helvetica,sans-serif;font-size:13px"><br>
</span></div><div><span style="font-family:arial,helvetica,sans-serif;font-size:13px">> #</span></div><div style="font-style:normal;font-size:10pt;font-family:arial,helvetica,sans-serif"><br></div><div style="font-style:normal;font-size:10pt;font-family:arial,helvetica,sans-serif">
<br></div><div style="font-style:normal;font-size:10pt;font-family:arial,helvetica,sans-serif">Obrigado pelas dicas e correções,</div><div style="font-style:normal;font-size:10pt;font-family:arial,helvetica,sans-serif"><br>
</div><div style="font-style:normal;font-size:10pt;font-family:arial,helvetica,sans-serif"><br></div><div style="font-style:normal;font-size:10pt;font-family:arial,helvetica,sans-serif">Alexandre</div></div><div style="font-style:normal;font-size:10pt;font-family:arial,helvetica,sans-serif">
<br></div><div class="hm HOEnZb"><div style="font-style:normal;font-size:10pt;font-family:arial,helvetica,sans-serif"><br></div></div></div><div class="hm HOEnZb"> </div><div style="font-family:arial,helvetica,sans-serif;font-size:10pt">
<div class="hm HOEnZb"> </div><div style="font-family:'times new roman','new york',times,serif;font-size:12pt"><div class="hm HOEnZb"> <div dir="ltr"> <font face="Arial"> <hr size="1"> <b><span style="font-weight:bold">De:</span></b> Benilton Carvalho <<a href="mailto:beniltoncarvalho@gmail.com" target="_blank">beniltoncarvalho@gmail.com</a>><br>
<b><span style="font-weight:bold">Para:</span></b> r-br <<a href="mailto:r-br@listas.c3sl.ufpr.br" target="_blank">r-br@listas.c3sl.ufpr.br</a>>; Alexandre Santos <<a href="mailto:alexandresantosbr@yahoo.com.br" target="_blank">alexandresantosbr@yahoo.com.br</a>> <br>
<b><span style="font-weight:bold">Enviadas:</span></b> Terça-feira, 20 de Novembro de 2012 16:30<br> <b><span style="font-weight:bold">Assunto:</span></b> Re: [R-br] Dúvida em summary em
regressão logística<br> </font> </div></div><div><div class="h5"> <br><div><div>Seu exemplo nao e' reproduzivel e seu modelo nao esta' correto.</div><div><br></div><div>Consulte seu estatistico local para esclarecimentos mais detalhados.</div>
<div><br></div><div>Uma regressao logistica modela a probabilidade de sucesso dado um conjunto de covariaveis. No seu caso, "sucesso" (para o predador) parece ser o herbivoro ser predado.</div>
<div><br></div><div>Dito isso, se "naoPred" fosse o numero de herbivoros que nao foram predados, a especificacao do seu modelo seria</div><div><br></div>
<div>glm(cbind(pred, naoPred)~poly(dens, 3, raw=TRUE), family='binomial')</div><div><br></div><div>Se vc usar a representacao na escala probalistica (note que faltam uns parenteses na sua representacao):</div>
<div><br></div><div>Prob(Sucesso) = exp(P0+P1*N+P2*N^2+P3*N^3)/(1+exp(P0+P1*N+P2*N^2+P3*N^3))</div><div><br></div><div>o resultado do summary (os coeficiences) mostrado(s) representa(m) respectivamente P0, P1, P2 e P3.</div>
<div><br></div><div>b</div><div><br><br><div>2012/11/20 Alexandre Santos <span dir="ltr"><<a rel="nofollow" href="mailto:alexandresantosbr@yahoo.com.br" target="_blank">alexandresantosbr@yahoo.com.br</a>></span><br>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div style="font-size:10pt;font-family:arial,helvetica,sans-serif">
<div align="center"><div style="text-align:left"><span style="background-color:transparent">Boa tarde Pessoal,</span></div><div style="text-align:left"><span style="background-color:transparent"> Estou ajustando uma regressão logística e me deparei com a seguinte dúvida:</span></div>
<div style="text-align:left"><span style="background-color:transparent"> </span></div><div><font face="arial, helvetica, sans-serif">###################################################################################################</font></div>
<div><font face="arial, helvetica, sans-serif">#Regressão logística entre a proporção de herbívoros predados e a densidade
de herbívoros oferecidos</font></div><div><font face="arial, helvetica, sans-serif">#</font></div><div><font face="arial, helvetica, sans-serif">pred<-c(1,2,2,3,1,4,2,3,2,3,5,6,5,5,3,7,7,6,2</font></div>
<div><font face="arial, helvetica, sans-serif">,3,15,12,14,12,11,11,11,13,13,13,18,14,27,26</font></div><div><font face="arial, helvetica, sans-serif">,17,18,20,22,10,15,29,30,36,40,23,50,30,40,29,52)##Número de herbívoros predados</font></div>
<div><font face="arial, helvetica, sans-serif">dens<-sort(rep(2^(2:6),10))#### Densidade de herbivoros oferecidos</font></div><div><font face="arial, helvetica, sans-serif">##</font></div>
<div><font face="arial, helvetica, sans-serif">##Regressão
pred/dens = exp(P0+P1*N+P2*N^2+P3*N3)/1+ exp(P0+P1*N+P2*N^2+P3*N3)</font></div><div><font face="arial, helvetica, sans-serif">p.model1<-glm(pred/par~dens+I(dens^2)+I(dens^3),family="binomial")</font></div>
<div><font face="arial, helvetica, sans-serif">summary(p.model1)</font></div><div><font face="arial, helvetica, sans-serif">#</font></div><div style="font-style:normal;font-size:13px;background-color:transparent;font-family:arial,helvetica,sans-serif">
<font face="arial, helvetica, sans-serif"><br></font></div><div style="font-style:normal;font-size:13px;background-color:transparent;font-family:arial,helvetica,sans-serif"><font face="arial, helvetica, sans-serif"><br>
</font></div><div><font face="arial, helvetica, sans-serif">Minha dúvida é se o coeficiente linear que aparece no summary esta transformado em exp(x)/1+exp(x)</font></div><div>
<font face="arial, helvetica, sans-serif">ou trata-se do valor sem transformação?</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Obrigado,</font></div>
<span><font color="#888888"><div style="font-style:normal;font-size:13px;background-color:transparent;font-family:arial,helvetica,sans-serif"><font face="arial, helvetica, sans-serif"><br></font></div>
<div style="font-style:normal;font-size:13px;background-color:transparent;font-family:arial,helvetica,sans-serif"><font face="arial, helvetica, sans-serif"><pre>--
======================================================================
Alexandre dos Santos
Proteção Florestal
IFMT - Instituto Federal de Educação, Ciência e Tecnologia de Mato Grosso - Campus Cáceres
Avenida dos Ramires, s/n
Bairro: Distrito Industrial
Cáceres - MT CEP: 78.200-000
Fone: <a rel="nofollow">(+55) 65 8132-8112</a> (TIM) <a rel="nofollow">(+55) 65 9686-6970</a> (VIVO)
<a rel="nofollow" href="mailto:e-mails:alexandresantosbr@yahoo.com.br" target="_blank">e-mails:alexandresantosbr@yahoo.com.br</a>
<a rel="nofollow" href="mailto:alexandre.santos@cas.ifmt.edu.br" target="_blank">alexandre.santos@cas.ifmt.edu.br</a>
======================================================================</pre></font></div><div style="font-style:normal;font-size:13px;background-color:transparent;font-family:arial,helvetica,sans-serif">
<font face="arial, helvetica, sans-serif"><br></font></div></font></span></div></div></div><br>_______________________________________________<br>
R-br mailing list<br>
<a rel="nofollow" href="mailto:R-br@listas.c3sl.ufpr.br" target="_blank">R-br@listas.c3sl.ufpr.br</a><br>
<a rel="nofollow" href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br" target="_blank">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a><br>
Leia o guia de postagem (<a rel="nofollow" href="http://www.leg.ufpr.br/r-br-guia" target="_blank">http://www.leg.ufpr.br/r-br-guia</a>) e forneça código mínimo reproduzível.<br></blockquote></div><br></div><div><br>
</div>
</div><br><br> </div></div></div> </div> </div></div></blockquote></div><br></div>