<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:12pt"><div><span>Valeu Walmes! O que importa é que resolveu! Obrigado de novo.</span></div><div><span><br></span></div><div><span>(S,f,P)</span></div><div><span>Allaman</span></div><div> </div><div style="background-color:transparent;" align="center"><font style="background-color:transparent;" face="comic sans ms" size="2"><font size="1"><b><br></b></font></font></div><div style="text-align:left;background-color:transparent;" align="center"><font style="background-color:transparent;"><font face="courier, monaco, monospace, sans-serif" size="2">\begin{signature}</font></font></div><div style="text-align:left;background-color:transparent;" align="center"><font style="background-color:transparent;"><font face="courier, monaco, monospace, sans-serif" size="2"><<>>=</font></font></div><div
style="text-align:left;background-color:transparent;" align="center"><font class="Apple-style-span" face="courier, monaco, monospace, sans-serif" size="2">Prof. Dr. Ivan Bezerra Allaman</font></div><div style="text-align:left;background-color:transparent;" align="center"><font class="Apple-style-span" face="courier, monaco, monospace, sans-serif" size="2">Universidade Estadual de Santa Cruz</font></div><div style="text-align:left;background-color:transparent;" align="center"><font class="Apple-style-span" face="courier, monaco, monospace, sans-serif" size="2">Departamento de Ciências Exatas e Tecnológicas</font></div><div style="text-align:left;background-color:transparent;" align="center"><font class="Apple-style-span" face="courier, monaco, monospace, sans-serif" size="2">Ilhéus/BA - Brasil</font></div><div style="text-align:left;background-color:transparent;" align="center"><font class="Apple-style-span" face="courier, monaco, monospace,
sans-serif" size="2">Fone: +55 73 3680-5076</font></div><div style="text-align:left;background-color:transparent;" align="center"><font class="Apple-style-span" face="courier, monaco, monospace, sans-serif" size="2">E-mail: ivanalaman@yahoo.com.br/ivanalaman@gmail.com</font></div><div style="text-align:left;background-color:transparent;" align="center"><font style="background-color:transparent;"><font face="courier, monaco, monospace, sans-serif" size="2">@</font></font></div><div style="text-align:left;background-color:transparent;" align="center"><font style="background-color:transparent;"><font face="courier, monaco, monospace, sans-serif" size="2">\end{signature}</font></font></div><div><br></div><div style="font-size: 12pt; font-family: arial, helvetica, sans-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; Ivan Bezerra Allaman <ivanalaman@yahoo.com.br><br><b><span style="font-weight: bold;">Enviadas:</span></b> Quinta-feira, 29 de Setembro de 2011 15:12<br><b><span style="font-weight: bold;">Assunto:</span></b> Re: [R-br] Função não reconhece variável extraída de um modelo!<br></font><br><div id="yiv1797543418"><font face="trebuchet ms,sans-serif">Ivan,<br><br>Dá pra fazer assim, embora eu acredito que exista um jeito mais simples, <br><br><span style="font-family: 'courier new', monospace; ">da <- expand.grid(A=factor(LETTERS[1:3]), x=1:10)</span><br style="font-family: 'courier new', monospace; ">
<span style="font-family: 'courier new', monospace; ">da$y <- 10/(1+exp(-(da$x-5)/1))+rnorm(da$x,0,0.1)</span><br style="font-family: 'courier new', monospace; "><br style="font-family: 'courier new', monospace; "><span style="font-family: 'courier new', monospace; ">n0 <- nls(y~As[A]/(1+exp(-(x-x0[A])/S[A])), data=da,</span><br style="font-family: 'courier new', monospace; ">
<span style="font-family: 'courier new', monospace; "> start=list(As=c(10,10,10), x0=c(5,5,5), S=c(1,1,1)))</span><br style="font-family: 'courier new', monospace; "><br style="font-family: 'courier new', monospace; "><span style="font-family: 'courier new', monospace; ">str(n0)</span><br style="font-family: 'courier new', monospace; ">
<span style="font-family: 'courier new', monospace; ">n0$data</span><br style="font-family: 'courier new', monospace; "><span style="font-family: 'courier new', monospace; ">eval(n0$data)</span><br style="font-family: 'courier new', monospace; ">
<span style="font-family: 'courier new', monospace; ">all.vars(summary(n0)$formula)[1]</span><br style="font-family: 'courier new', monospace; "><span style="font-family: 'courier new', monospace; ">eval(n0$data)[,all.vars(summary(n0)$formula)[1]]</span><br style="font-family: 'courier new', monospace; ">
<span style="font-family: 'courier new', monospace; ">mean(eval(n0$data)[,all.vars(summary(n0)$formula)[1]])</span><br style="font-family: 'courier new', monospace; "><br style="font-family: 'courier new', monospace; "><span style="font-family: 'courier new', monospace; ">fun <- function(n0){</span><br style="font-family: 'courier new', monospace; ">
<span style="font-family: 'courier new', monospace; "> mean(eval(n0$data)[,all.vars(summary(n0)$formula)[1]])</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; ">fun(n0)</span><br style="font-family: 'courier new', monospace; "><br style="font-family: 'courier new', monospace; ">À 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></div></div></div></body></html>