<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>Obrigado pelas colaborações, foram muito esclarecedoras!</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal; "><span><br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal; "><span>Walmes, no fim o que você chama de dupla exponencial, é apenas uma reparametrização no logístico duplo não é?</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal; "><span>Como ficaria para esta situação um gompertz duplo, ou dupla exponencial reparametrizando o modelo de
 gompertz?</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal; "><span><br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: 'times new roman', 'new york', times, serif; background-color: transparent; font-style: normal; "><span>Att;</span></div><div> </div><div style="text-align:center;"><span style="text-decoration:underline;">Tales Jesus Fernandes</span><br style="text-decoration:underline;"><span style="text-decoration:underline;">Doutorando em Estatística UFLA</span><br><span style="text-decoration:underline;">Universidade Federal de Lavras</span><br></div><div><br></div>  <div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "> <div style="font-family: 'times new roman', 'new york', times, serif; font-size: 12pt; "> <div dir="ltr"> <font size="2" face="Arial"> <hr
 size="1">  <b><span style="font-weight:bold;">De:</span></b> Walmes Zeviani <walmeszeviani@gmail.com><br> <b><span style="font-weight: bold;">Para:</span></b> Tales Fernandes <talesest@yahoo.com.br> <br><b><span style="font-weight: bold;">Cc:</span></b> "r-br@listas.c3sl.ufpr.br" <r-br@listas.c3sl.ufpr.br> <br> <b><span style="font-weight: bold;">Enviadas:</span></b> Terça-feira, 11 de Setembro de 2012 11:28<br> <b><span style="font-weight: bold;">Assunto:</span></b> Re: [R-br] Auto-correlação residual utilizando a gnls<br> </font> </div> <br><div id="yiv1175609709"><font face="trebuchet ms,sans-serif">Tales,<br><br>Tome cuido com o exagero. O R e outros aplicativos possuem muitas funções e flexibilidade na hora de criar modelos mas nós temos que ser cautelosos, entender o modelo que estamos propondo e críticos o suficiente para aceitar esses modelos. Você não tem tantos dados assim e está se propondo a modelar variância e
 correlação simultaneamente. Não tô dizendo que você esteja errado. Você vai ver abaixo que existe problemas de convergência, ou talvez de identificabilidade. Você tá propondo um modelo grande demais. No final eu coloco um duplo exponencial só pra você ver que existe mais de uma solução possível.<br>
<br>rm(list=ls())<br>library(car)<br>library(nlme)<br>library(qpcR) # para calcular o R2<br>require(nls2)<br><br>daf=c(96,111,126,141,158,174,189,204,219,235,250,265,279,293)<br>diff(daf) # espaçamento não exatamente iguais, AR(1) assume equidistância<br>
mfs2=c(0.014,0.027,0.033,0.189,0.439,0.602,0.653,0.671,0.775,0.814,0.911,1.012,1.059,1.005)<br>ordem <- seq_along(daf)<br><br>plot(mfs2~daf)<br><br>args(SSlogis)<br>n0 <- nls(mfs2~SSlogis(daf, A, x0, S))<br>par(mfrow=c(2,2)); plot(as.lm(n0)); layout(1)<br>
# na minha opinião, esse tamanho de amostra é insuficiente para afirmar<br># qualquer padrão de variância e correlação...<br><br>acf(residuals(n0))  # indicaria fracamente médias móveis<br>pacf(residuals(n0)) # indica AR(2)<br>
<br># Logístico<br>reg1=gnls(mfs2~((alfa)/(1 + exp(beta - gama*daf))),<br>  start=c(alfa=1.5,beta=3,gama=0.015),<br>  weights=varExp(form=~daf),<br>  correlation=corAR1(form=~daf))<br>summary(reg1)<br>anova(reg1, n0)<br>## não diferiu no meu modelo mais simples (homocedástico e independente)<br>
<br>reg3=gnls(mfs2~((alfa)/(1 + exp(beta - gama*daf))),<br>  start=c(alfa=1.5,beta=3,gama=0.015),<br>  weights=varExp(form=~daf),<br>  correlation=corAR1(form=~1))<br>summary(reg3)<br>anova(reg3, n0)<br><br>reg4 <- gnls(mfs2~((alfa)/(1 + exp(beta - gama*daf))),<br>
             start=c(alfa=1.5,beta=3,gama=0.015),<br>             weights=varExp(form=~daf),<br>             correlation=corAR1(value=0.01, form=~ordem))<br>summary(reg4)<br># veja que modelo 3 e 4 são iguais, pois corAR1() assume a ordem das observações no vetor<br>
anova(reg4, n0)<br><br># essa significancia é problema de mínimo local, veja que dando um chute mais<br># adequado para assintota, a estimativa de phi é outra<br><br>reg5 <- gnls(mfs2~((alfa)/(1 + exp(beta - gama*daf))),<br>
             start=c(alfa=1,beta=3,gama=0.015), # chute para alfa=1<br>             weights=varExp(form=~daf),<br>             correlation=corAR1(form=~ordem))<br>summary(reg4)<br>anova(reg5, n0)<br><br>logLik(reg4)<br>logLik(reg5)<br>
<br>plot(daf,mfs2, main="Modelo Logístico")<br>lines(daf,fitted(n0),col=1)   # sem hetero e correl, not bad<br>lines(daf,fitted(reg1),col=2) # usando AR1(~daf), not bad<br>lines(daf,fitted(reg3),col=3) # usando AR1(~1), completamente sem sentido<br>
lines(daf,fitted(reg4),col=4) # usando AR1(~ordem), mesma coisa<br>lines(daf,fitted(reg5),col=5) # usando AR1(~ordem), mínimo global<br><br># o padrão dos dados sugere duas logísticas, como se fosse crescimento de insetos<br>
# cada logística tem relação com as ecdises<br><br>reg6 <- nls(mfs2~A1/(1+exp(-(daf-d1)/S1))+(A2-A1)/(1+exp(-(daf-d2)/S2)),<br>            start=list(A1=0.6, d1=170, S1=20, A2=1, d2=250, S2=15))<br>summary(reg6)<br>confint.default(reg6) # aponta que S1 e S2 podem ser iguais, faz até sentido<br>
par(mfrow=c(2,2)); plot(as.lm(reg6)); layout(1)<br><br>pred <- data.frame(daf=seq(90, 300, length=100))<br>pred$y <- predict(reg6, newdata=pred)<br><br>plot(daf,mfs2, main="Modelo Logístico")<br>lines(y~daf, data=pred)<br>
abline(h=coef(reg6)[c(1,4)], lty=3)<br>abline(v=coef(reg6)[c(2,5)], lty=3)<br><br>lapply(list(n0, reg3, reg4, reg5, reg6), logLik)<br># ultimo modelo com a maior verossimilhança<br><br>À disposição.<br>Walmes.<br><br clear="all">
</font><span style="font-family: 'trebuchet ms', sans-serif; ">==========================================================================</span><br style="font-family: 'trebuchet ms', sans-serif; "><span style="font-family: 'trebuchet ms', sans-serif; ">Walmes Marques Zeviani</span><br style="font-family: 'trebuchet ms', sans-serif; ">
<span style="font-family: 'trebuchet ms', sans-serif; ">LEG (Laboratório de Estatística e Geoinformação, 25.450418 S, 49.231759 W)</span><br style="font-family: 'trebuchet ms', sans-serif; "><span style="font-family: 'trebuchet ms', sans-serif; ">Departamento de Estatística - Universidade Federal do Paraná</span><br style="font-family: 'trebuchet ms', sans-serif; ">
<span style="font-family: 'trebuchet ms', sans-serif; ">fone: (+55) 41 3361 3573</span><br style="font-family: 'trebuchet ms', sans-serif; "><span style="font-family: 'trebuchet ms', sans-serif; ">VoIP: (3361 3600) 1053 1173</span><br style="font-family: 'trebuchet ms', sans-serif; ">
<span style="font-family: 'trebuchet ms', sans-serif; ">e-mail: <a rel="nofollow" ymailto="mailto:walmes@ufpr.br" target="_blank" href="mailto:walmes@ufpr.br">walmes@ufpr.br</a></span><br style="font-family: 'trebuchet ms', sans-serif; "><span style="font-family: 'trebuchet ms', sans-serif; ">twitter: @walmeszeviani</span><br style="font-family: 'trebuchet ms', sans-serif; ">
<span style="font-family: 'trebuchet ms', sans-serif; ">homepage: <a rel="nofollow" target="_blank" href="http://www.leg.ufpr.br/~walmes">http://www.leg.ufpr.br/~walmes</a></span><br style="font-family: 'trebuchet ms', sans-serif; "><span style="font-family: 'trebuchet ms', sans-serif; ">linux user number: 531218</span><br style="font-family: 'trebuchet ms', sans-serif; ">
<span style="font-family: 'trebuchet ms', sans-serif; ">==========================================================================</span><br>
</div><br><br> </div> </div>  </div></body></html>