<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:10pt"><div><span>Você pode fazer como está no help da função, veja:<br></span></div><div><span><br></span></div><div><span> require(minpack.lm)</span></div><div><span><br></span></div><div><span> luz=c(0,25,50,75,100,500,1000,1500,2000)<br> Pn=c(-0.60375, 0.04300,0.27000,0.90175,1.39225,2.70350,4.93100,4.31000, 3.80075)<br><br>ps<-list(a=1,b=1)<br>model1=function(ps,xx){(((0.01940*xx+ps$a+0.60375)-(((0.01940*xx+ps$a+0.60375)^2)-4*0.01940*xx*ps$b*(ps$a+0.60375))^0.5)/2*ps$b)-0.60375}<br>resid1=function(observed,ps,xx){observed-model1(ps,xx)}<br>lin1=nls.lm(ps,resid1,observed=Pn, xx=luz)<br>summary(lin1)<br><br><br>preditos <- model1(as.list(coef(lin1)), luz)<br>plot(luz, Pn)<br>points(luz, preditos, col =
2)</span></div><div><br><span></span></div><div><span>At</span></div><div><br><span></span></div><div><span>Gustavo Marcatti</span></div><div><span>Eng. Florestal - UFV</span></div><div><br></div> <div style="font-family: times new roman, new york, times, serif; font-size: 10pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" size="2"> <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> Quinta-feira, 26 de Janeiro de 2012 12:16<br> <b><span style="font-weight: bold;">Assunto:</span></b> Re: [R-br] predict com minpack.lm<br> </font> </div> <br><meta http-equiv="x-dns-prefetch-control" content="off"><div id="yiv1582165619"><font face="trebuchet ms,sans-serif">Gilson,<br><br>Se
você tem os valores das covariáveis, as estimativas dos parâmetros e o modelo, é só fazer a conta que você tem os valores preditos. Crie uma função mypredit() para isso, i.e.<br>
<br><span style="font-family:courier new, monospace;">cov <- cbind(x=1:10, z=runif(10))</span><br style="font-family:courier new, monospace;"><span style="font-family:courier new, monospace;">betas <- c(A=10.1, B=2.2)</span><br style="font-family:courier new, monospace;">
<span style="font-family:courier new, monospace;">model <- function(beta, covs){ betas["A"]*covs["x"]/(beta["B"]+covs["x"])+beta["B"]*covs["z"] }</span><br style="font-family:courier new, monospace;">
<span style="font-family:courier new, monospace;">preditos <- apply(cov, 1, model, beta=betas)</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><meta http-equiv="x-dns-prefetch-control" content="on"><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>