<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:14pt"><div><span>Obrigado Walmes. </span></div><div><span><br></span></div><div><span>Exatamente isso.</span></div><div><span><br></span></div><div><span>Emmanuel</span></div><div><br></div>  <div style="font-size: 14pt; font-family: 'times new roman', 'new york', times, serif; "> <div style="font-size: 12pt; font-family: 'times new roman', 'new york', times, serif; "> <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> r-br@listas.c3sl.ufpr.br <br> <b><span style="font-weight: bold;">Enviadas:</span></b> Sexta-feira, 2 de Dezembro de 2011 9:44<br> <b><span style="font-weight: bold;">Assunto:</span></b> Re: [R-br] Estimar vários modelos não lineares de uma só vez<br> </font> <br><div
 id="yiv1457179762"><font face="trebuchet ms,sans-serif">É possível sim. Use apply(), para jogar uma coluna por vez para a nls(), </font><font face="trebuchet ms,sans-serif">ou talvez melhor, deixe as y em uma lista de vetores e use lapply()</font><font face="trebuchet ms,sans-serif">. Se o mesmo modelo o chutes podem ser usados, isso não será complicado. Na situação em que os chutes podem mudar é mais indicado criar uma função selfStart para se livrar da tarefa de atribuir chutes.<br>
<br><span style="font-family: 'courier new', monospace; ">x <- 1:10</span><br style="font-family: 'courier new', monospace; "><span style="font-family: 'courier new', monospace; ">y <- list()</span><br style="font-family: 'courier new', monospace; ">
<span style="font-family: 'courier new', monospace; ">y$y1 <- 10*x/(2+x)+rnorm(x,0,0.1)</span><br style="font-family: 'courier new', monospace; "><span style="font-family: 'courier new', monospace; ">y$y2 <- 10*x/(2+x)+rnorm(x,0,0.1)</span><br style="font-family: 'courier new', monospace; ">
<span style="font-family: 'courier new', monospace; ">y$y3 <- 10*x/(2+x)+rnorm(x,0,0.1)</span><br style="font-family: 'courier new', monospace; "><span style="font-family: 'courier new', monospace; ">matplot(x, do.call(cbind, y))</span><br style="font-family: 'courier new', monospace; ">
<br style="font-family: 'courier new', monospace; "><span style="font-family: 'courier new', monospace; ">nls.l <- lapply(y,</span><br style="font-family: 'courier new', monospace; "><span style="font-family: 'courier new', monospace; ">                function(yi){</span><br style="font-family: 'courier new', monospace; ">
<span style="font-family: 'courier new', monospace; ">                  n0 <- nls(yi~A*x/(B+x), start=c(A=10, B=3))</span><br style="font-family: 'courier new', monospace; "><span style="font-family: 'courier new', monospace; ">                  n0</span><br style="font-family: 'courier new', monospace; ">
<span style="font-family: 'courier new', monospace; ">                })</span><br style="font-family: 'courier new', monospace; "><span style="font-family: 'courier new', monospace; ">lapply(nls.l, coef)</span><br style="font-family: 'courier new', monospace; ">
<span style="font-family: 'courier new', monospace; ">lapply(nls.l, summary)</span><br style="font-family: 'courier new', monospace; "><span style="font-family: 'courier new', monospace; ">lapply(nls.l, fitted)</span><br style="font-family: 'courier new', monospace; ">
<span style="font-family: 'courier new', monospace; ">lapply(nls.l, residuals)</span><br style="font-family: 'courier new', monospace; "><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/%7Ewalmes">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>R-br mailing list<br><a ymailto="mailto:R-br@listas.c3sl.ufpr.br" href="mailto:R-br@listas.c3sl.ufpr.br">R-br@listas.c3sl.ufpr.br</a><br><a 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 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><br> </div> </div>  </div></body></html>