<div dir="ltr">Odirley Campos, bom dia.<div><br></div><div>Recomendo que use o pacote ExpDes lá você encontrará o que precisa e tudo isso em apenas uma linha de comando. Acesse o link e confira.</div><div><br></div><div><a href="http://cran.r-project.org/web/packages/ExpDes/ExpDes.pdf">http://cran.r-project.org/web/packages/ExpDes/ExpDes.pdf</a> </div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-03-11 22:52 GMT-03:00 Odirley Campos <span dir="ltr"><<a href="mailto:camposagro@yahoo.com.br" target="_blank">camposagro@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:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif"><div>
Srs(as), boa noite.</div><div>Sou iniciante no R. Como faço para ajustar um modelo de 2º grau para os dados abaixo. Antecipademante agradeco<br></div><div>
<div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span style="font-size:10.0pt;font-family:"Courier New";color:red">a<-read.table("dose_fcr_ph2.txt",
h=T)</span></div>
<div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span style="font-size:10.0pt;font-family:"Courier New";color:red">names(a)</span></div>
<div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span style="font-size:10.0pt;font-family:"Courier New";color:red">tra<-as.factor(a$trat)
</span><span style="font-size:10.0pt;font-family:"Courier New"">#usado apenas
para verificar pressupostos da anova</span></div>
<div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span style="font-size:10.0pt;font-family:"Courier New";color:red">fcr<-as.factor(a$fcr)
</span><span style="font-size:10.0pt;font-family:"Courier New"">#4 niveis
(1500, 2000, 2500 e 3000)<span style="color:red"></span></span></div>
<div class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal;color:red;font-size:13.3333px;font-family:"Courier New";background-color:transparent;font-style:normal"><span style="font-size:10.0pt;font-family:"Courier New";color:red">dos<-as.factor(a$dose)
</span><span style="font-size:10.0pt;font-family:"Courier New""><span style="color:rgb(0,0,0)">#3 niveis (0,
1, 2), tratado como qualitativo</span><span style="color:red"></span></span></div>
<div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span style="font-size:10.0pt;font-family:"Courier New";color:red" lang="EN-US">ph<-as.numeric(a$ph)</span></div>
<div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span style="font-size:10.0pt;font-family:"Courier New";color:red">b<-data.frame(tra,fcr,dos,ph)</span></div>
<div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span style="font-size:10.0pt;font-family:"Courier New";color:red">b</span></div>
<div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span style="font-size:10.0pt;font-family:"Courier New";color:red">>
fcr</span></div>
<div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span style="font-size:10.0pt;font-family:"Courier New""><span> </span>[1] 1500 1500 1500 2000 2000 2000 2500 2500
2500 3000 3000 3000 1500 1500 1500</span></div>
<div class="MsoNormal" style="line-height:normal;font-style:normal;font-size:13.3333px;background-color:transparent;margin-bottom:0.0001pt;font-family:"Courier New""><span style="font-size:10.0pt;font-family:"Courier New""><a href="tel:%5B16%5D%202000%202000" value="+551620002000" target="_blank">[16] 2000 2000</a>
2000 2500 2500 2500 3000 3000 3000 1500 1500 1500 2000 2000 2000</span></div>
<div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span style="font-size:10.0pt;font-family:"Courier New""><a href="tel:%5B31%5D%202500%202500" value="+553125002500" target="_blank">[31] 2500 2500</a>
2500 3000 3000 3000</span></div>
<div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span style="font-size:10.0pt;font-family:"Courier New";color:red">>
dos</span></div>
<div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span style="font-size:10.0pt;font-family:"Courier New""><span> </span>[1] 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1
1 1 1 2 2 2 2 2 2 2 2 2 2 2 2</span></div>
<div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span style="font-size:10.0pt;font-family:"Courier New";color:red">>
ph</span></div>
<div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span style="font-size:10.0pt;font-family:"Courier New""><span> </span>[1] 5.86 6.19 6.87 5.87 6.30 6.30 6.05 6.37
7.03 5.69 5.72 6.52 6.05 6.02 6.09</span></div>
<div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span style="font-size:10.0pt;font-family:"Courier New"">[16] 6.19 6.73
6.80 7.08 7.08 7.08 9.25 8.81 9.06 9.25 9.24 8.81 9.13 8.97 9.36</span></div>
<div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span style="font-size:10.0pt;font-family:"Courier New"">[31] 9.05 8.99
8.93 9.21 8.90 7.42</span></div>
<div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"></div></div><div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal">
<div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span style="font-size:10.0pt;font-family:"Courier New";color:red">ane2<-aov(ph~dos*fcr,
data=b)</span></div>
<div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span style="font-size:10.0pt;font-family:"Courier New";color:red">summary(ane2)</span><span style="font-size:10.0pt;font-family:"Courier New"">#tenho interesse no
desdobramento</span></div>
<div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span style="font-size:10.0pt;font-family:"Courier New"" lang="EN-US">#<span> </span>Df
Sum Sq Mean Sq F value<span> </span>Pr(>F)<span> </span></span></div>
<div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span style="font-size:10.0pt;font-family:"Courier New"">#dos<span> </span>2<span>
</span>45.25<span> </span>22.625 137.133 7.37e-14 ***</span></div>
<div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span style="font-size:10.0pt;font-family:"Courier New"">#fcr<span> </span>3<span>
</span>2.44<span> </span>0.812<span> </span>4.921<span>
</span>0.00836 ** </span></div>
<div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span style="font-size:10.0pt;font-family:"Courier New"">#dos:fcr<span> </span>6<span>
</span>14.08<span> </span>2.347<span> </span>14.223 7.24e-07 ***</span></div>
<div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span style="font-size:10.0pt;font-family:"Courier New"">#</span><span lang="EN-US">Residuals<span> </span>24<span> </span>3.96<span>
</span>0.165<span> </span></span></div>
<div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span style="font-size:10.0pt;font-family:"Courier New";color:red"></span></div></div><div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal">
<div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span style="font-size:10.0pt;font-family:"Courier New";color:red">ane3<-aov(ph~dos/fcr,
data=b)</span><span style="font-size:10.0pt;font-family:"Courier New";color:#365f91"> </span><span style="font-size:10.0pt;font-family:"Courier New"">#guarda efeitos aninhados<span style="color:#365f91"></span></span></div>
</div><div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><div class="MsoNormal" style="margin-bottom:0.0001pt;line-height:normal;color:rgb(255,0,0);font-size:13.3333px;font-family:"Courier New";background-color:transparent;font-style:normal">
<span style="font-size:10.0pt;font-family:"Courier New";color:red">summary(ane3,
split=list("dos:fcr"=list("dos0"=c(1,4,7), "dos1"=c(2,5,8),
"dos2"=c(3,6,9))))</span></div>
<div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span style="font-size:10.0pt;font-family:"Courier New"">#<span> </span>Df<span> </span>Sum Sq<span>
</span>Meam Sq<span> </span><span> </span>F value<span>
</span>Pr(>F)<span> </span></span></div>
<div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span style="font-size:10.0pt;font-family:"Courier New"">#dos<span> </span>2<span>
</span>45.10<span> </span>22.550<span> </span>43.910 <span> </span><span> </span>9.56e-09 ***</span></div>
<div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span style="font-size:10.0pt;font-family:"Courier New"">#dos:fcr<span> </span>9<span>
</span>8.69<span> </span>0.966<span> </span>1.881<span>
</span><span> </span>0.10465<span> </span></span></div>
<div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span style="font-size:10.0pt;font-family:"Courier New"">#dos:fcr:
dos0<span> </span>3<span>
</span>0.42<span> </span><span> </span>0.140<span>
</span>0.272<span> </span><span> </span>0.84507<span>
</span></span></div>
<div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span style="font-size:10.0pt;font-family:"Courier New"">#dos:fcr:
dos1<span> </span>3<span>
</span>7.50<span> </span>2.499<span> </span>4.866<span>
</span><span> </span>0.00877 ** </span></div>
<div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span style="font-size:10.0pt;font-family:"Courier New"">#dos:fcr:
dos2<span> </span>3<span>
</span>0.78<span> </span>0.259<span> </span>0.503 <span> </span>0.68359<span>
</span></span></div>
<div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span style="font-size:10.0pt;font-family:"Courier New"" lang="EN-US">#Residuals<span>
</span>24<span> </span>12.33<span> </span>0.514<span> </span></span></div>
<div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><span style="font-size:10.0pt;font-family:"Courier New"" lang="EN-US">#Signif. codes:<span>
</span>0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ </span><span style="font-size:10.0pt;font-family:"Courier New"">0.1 ‘ ’ 1</span></div>
</div><div class="MsoNormal" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:normal"><div class="MsoNormal" style="line-height:normal;font-style:normal;font-size:10pt;background-color:transparent;margin-bottom:0.0001pt;font-family:"Courier New"">
#---------------------------------------------------------<br></div><div class="MsoNormal" style="line-height:normal;font-style:normal;font-size:13.3333px;background-color:transparent;margin-bottom:0.0001pt;font-family:"Courier New"">
#Ajustando modelo de 2 grau</div><div class="MsoNormal" style="line-height:normal;font-style:normal;font-size:10pt;background-color:transparent;margin-bottom:0.0001pt;font-family:"Courier New""><span style="color:rgb(205,35,44)">> m1<-aov(ph~-1+ dos/(fcr+I(fcr^2)), data=b)</span># aparece a mesagem de erro abaixo <br>
#Erro em `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) : <br>#contrastes podem ser aplicados
apenas a fatores com 2 ou mais níveis<br>#Além disso: Mensagens de aviso perdidas:<br>#In Ops.factor(fcr, 2) : ^ not meaningful for factors<br><span style="font-size:10.0pt;font-family:"Courier New""><span style="color:#365f91"></span></span></div>
</div><div>
</div><div><span style="font-weight:bold"><span style="color:rgb(157,24,17)"> # está faltando alguma informação no "comando"?</span></span><br><br><br></div><div style="text-align:center">Odirley R. Campos<br>Engenheiro Agrônomo UFV/MG</div>
<div style="text-align:center;font-style:normal;font-size:13px;background-color:transparent;font-family:arial,helvetica,clean,sans-serif"><br><br></div></div></div><br>_______________________________________________<br>
R-br mailing list<br>
<a 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></blockquote></div><br><br clear="all"><div><br></div>-- <br>
<div dir="ltr"><font size="4">Wagner Rogério Ferreira Pinheiro</font><div><br></div><div>Bacharel em Estatística (UFPA)</div><div><div>Mestre em Estatística Aplicada e Biometria (UFV)</div><div>---------------------------------------------------------------------</div>
<div><b>Contatos:</b></div><div>Fone: (31) 9258-2495</div><div> (31) 7143-5968</div><div>Skype: wagnerpinheiro01<br><div><br><br></div></div></div></div>
</div>