<div dir="ltr">Olá!!<div><br></div><div>Alguém, por gentileza, poderia me dizer por que o modelo está dando erro?</div><div><br></div><div><div style="font-family:arial,sans-serif;font-size:13px">Segue:<br></div><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px"><div># Gerando dados</div><div>tabela<-read.csv("morfo.csv",sep=";",head=T)</div><div>tabela$SX<-as.factor(tabela$SX)</div><div>
<br></div><div>#criar a lista de dados para o jags</div><div>lddados <- list(y=tabela$SX,</div><div><span style="white-space:pre-wrap"> </span> N=length(tabela$SX),</div><div><span style="white-space:pre-wrap"> </span> CT=tabela$CT,</div>
<div><span style="white-space:pre-wrap"> </span> CF=tabela$CF,</div><div><span style="white-space:pre-wrap"> </span> CP=tabela$CP,</div><div><span style="white-space:pre-wrap"> </span> CC=tabela$CC,</div><div>
<span style="white-space:pre-wrap"> </span> FO=tabela$FO,</div><div><span style="white-space:pre-wrap"> </span> AC=tabela$AC,</div><div><span style="white-space:pre-wrap"> </span> PD=tabela$PD,</div><div><span style="white-space:pre-wrap"> </span> CD=tabela$CD,</div>
<div><span style="white-space:pre-wrap"> </span> BD=tabela$BD,</div><div><span style="white-space:pre-wrap"> </span> PP=tabela$PP,</div><div><span style="white-space:pre-wrap"> </span> CPT=tabela$CPT,</div><div>
<span style="white-space:pre-wrap"> </span> BP=tabela$BP,</div><div><span style="white-space:pre-wrap"> </span> PV=tabela$PV,</div><div><span style="white-space:pre-wrap"> </span> BV=tabela$BV,</div><div><span style="white-space:pre-wrap"> </span> LC=tabela$LC,</div>
<div><span style="white-space:pre-wrap"> </span> CV=tabela$CV,</div><div><span style="white-space:pre-wrap"> </span> PA=tabela$PA,</div><div><span style="white-space:pre-wrap"> </span> BA=tabela$BA,</div><div>
<span style="white-space:pre-wrap"> </span> CA=tabela$CA,</div><div><span style="white-space:pre-wrap"> </span> AP=tabela$AP,</div><div><span style="white-space:pre-wrap"> </span> LP=tabela$LP,</div><div><span style="white-space:pre-wrap"> </span> CM=tabela$CM,</div>
<div><span style="white-space:pre-wrap"> </span> DOH=tabela$DOH,</div><div><span style="white-space:pre-wrap"> </span> DOV=tabela$DOV)</div><div><br></div><div>#criar modelo</div><div>sink('morfo.txt')</div>
<div>cat('</div><div><span style="white-space:pre-wrap"> </span>model{</div><div><span style="white-space:pre-wrap"> </span>for(i in 1:N){ # loop sobre as observações</div><div><span style="white-space:pre-wrap"> </span>y[i] ~ dbern(p[i]) # saída binária</div>
<div><span style="white-space:pre-wrap"> </span>logit(p[i]) <- beta0 # regressão multivariada</div><div><span style="white-space:pre-wrap"> </span> + beta1*CT[i]</div><div><span style="white-space:pre-wrap"> </span> + beta2*CF[i]</div>
<div><span style="white-space:pre-wrap"> </span> + beta3*CP[i]</div><div><span style="white-space:pre-wrap"> </span> + beta4*CC[i]</div><div><span style="white-space:pre-wrap"> </span> + beta5*FO[i]</div><div>
<span style="white-space:pre-wrap"> </span> + beta6*AC[i]</div><div><span style="white-space:pre-wrap"> </span> + beta7*PD[i]</div><div><span style="white-space:pre-wrap"> </span> + beta8*CD[i]</div><div><span style="white-space:pre-wrap"> </span> + beta9*BD[i]</div>
<div><span style="white-space:pre-wrap"> </span> + beta10*PP[i]</div><div><span style="white-space:pre-wrap"> </span> + beta11*CPT[i]</div><div><span style="white-space:pre-wrap"> </span> + beta12*BP[i]</div><div>
<span style="white-space:pre-wrap"> </span> + beta13*PV[i]</div><div><span style="white-space:pre-wrap"> </span> + beta14*BV[i]</div><div><span style="white-space:pre-wrap"> </span> + beta15*LC[i]</div><div><span style="white-space:pre-wrap"> </span> + beta16*CV[i]</div>
<div><span style="white-space:pre-wrap"> </span> + beta17*PA[i]</div><div><span style="white-space:pre-wrap"> </span> + beta18*BA[i]</div><div><span style="white-space:pre-wrap"> </span> + beta19*CA[i]</div><div>
<span style="white-space:pre-wrap"> </span> + beta20*AP[i]</div><div><span style="white-space:pre-wrap"> </span> + beta21*LP[i]</div><div><span style="white-space:pre-wrap"> </span> + beta22*CM[i]</div><div><span style="white-space:pre-wrap"> </span> + beta23*DOH[i]</div>
<div><span style="white-space:pre-wrap"> </span> + beta24*DOV[i]</div><div><span style="white-space:pre-wrap"> </span>}</div><div><span style="white-space:pre-wrap"> </span># Prioris</div><div><span style="white-space:pre-wrap"> </span>beta0 ~ dnorm(0,1.0E-6)</div>
<div><span style="white-space:pre-wrap"> </span>beta1 ~ dnorm(0,1.0E-6)</div><div><span style="white-space:pre-wrap"> </span>beta2 ~ dnorm(0,1.0E-6)</div><div><span style="white-space:pre-wrap"> </span>beta3 ~ dnorm(0,1.0E-6)</div>
<div><span style="white-space:pre-wrap"> </span>beta4 ~ dnorm(0,1.0E-6)</div><div><span style="white-space:pre-wrap"> </span>beta5 ~ dnorm(0,1.0E-6)</div><div><span style="white-space:pre-wrap"> </span>beta6 ~ dnorm(0,1.0E-6)</div>
<div><span style="white-space:pre-wrap"> </span>beta7 ~ dnorm(0,1.0E-6)</div><div><span style="white-space:pre-wrap"> </span>beta8 ~ dnorm(0,1.0E-6)</div><div><span style="white-space:pre-wrap"> </span>beta9 ~ dnorm(0,1.0E-6)</div>
<div><span style="white-space:pre-wrap"> </span>beta10 ~ dnorm(0,1.0E-6)</div><div><span style="white-space:pre-wrap"> </span>beta11 ~ dnorm(0,1.0E-6)</div><div><span style="white-space:pre-wrap"> </span>beta12 ~ dnorm(0,1.0E-6)</div>
<div><span style="white-space:pre-wrap"> </span>beta13 ~ dnorm(0,1.0E-6)</div><div><span style="white-space:pre-wrap"> </span>beta14 ~ dnorm(0,1.0E-6)</div><div><span style="white-space:pre-wrap"> </span>beta15 ~ dnorm(0,1.0E-6)</div>
<div><span style="white-space:pre-wrap"> </span>beta16 ~ dnorm(0,1.0E-6)</div><div><span style="white-space:pre-wrap"> </span>beta17 ~ dnorm(0,1.0E-6)</div><div><span style="white-space:pre-wrap"> </span>beta18 ~ dnorm(0,1.0E-6)</div>
<div><span style="white-space:pre-wrap"> </span>beta19 ~ dnorm(0,1.0E-6)</div><div><span style="white-space:pre-wrap"> </span>beta20 ~ dnorm(0,1.0E-6)</div><div><span style="white-space:pre-wrap"> </span>beta21 ~ dnorm(0,1.0E-6)</div>
<div><span style="white-space:pre-wrap"> </span>beta22 ~ dnorm(0,1.0E-6)</div><div><span style="white-space:pre-wrap"> </span>beta23 ~ dnorm(0,1.0E-6)</div><div><span style="white-space:pre-wrap"> </span>beta24 ~ dnorm(0,1.0E-6)</div>
<div><span style="white-space:pre-wrap"> </span>}</div><div>')</div><div><br></div><div>sink()</div><div><br></div><div>#carregar a biblioteca jags</div><div>library(rjags)</div><div><br></div><div>#definir os parâmetros para as posteriores</div>
<div><br></div><div>params <- c("beta0",</div><div> "beta1",</div><div><span style="white-space:pre-wrap"> </span> <span style="white-space:pre-wrap"> </span>"beta2",</div><div>
"beta3",</div><div><span style="white-space:pre-wrap"> </span>"beta4",</div><div> "beta5",</div><div> "beta6",</div><div><span style="white-space:pre-wrap"> </span> <span style="white-space:pre-wrap"> </span>"beta7",</div>
<div> "beta8",</div><div><span style="white-space:pre-wrap"> </span>"beta9",</div><div> "beta10",</div><div> "beta11",</div><div><span style="white-space:pre-wrap"> </span> <span style="white-space:pre-wrap"> </span>"beta12",</div>
<div> "beta13",</div><div><span style="white-space:pre-wrap"> </span>"beta14",</div><div> "beta15",</div><div> "beta16",</div><div><span style="white-space:pre-wrap"> </span> <span style="white-space:pre-wrap"> </span>"beta17",</div>
<div> "beta18",</div><div><span style="white-space:pre-wrap"> </span>"beta19",</div><div> "beta20",</div><div> "beta21",</div><div><span style="white-space:pre-wrap"> </span> <span style="white-space:pre-wrap"> </span>"beta22",</div>
<div> "beta23",</div><div><span style="white-space:pre-wrap"> </span>"beta24")</div><div><br></div><div>#inicializar cadeia</div><div>inicio <- list(beta0=0,</div><div><span style="white-space:pre-wrap"> </span> beta1=0,</div>
<div><span style="white-space:pre-wrap"> </span> beta2=0,</div><div><span style="white-space:pre-wrap"> </span> beta3=0,</div><div><span style="white-space:pre-wrap"> </span> beta4=0,</div><div><span style="white-space:pre-wrap"> </span> beta5=0,</div>
<div><span style="white-space:pre-wrap"> </span> beta6=0,</div><div><span style="white-space:pre-wrap"> </span> beta7=0,</div><div><span style="white-space:pre-wrap"> </span> beta8=0,</div><div><span style="white-space:pre-wrap"> </span> beta9=0,</div>
<div><span style="white-space:pre-wrap"> </span> beta10=0,</div><div><span style="white-space:pre-wrap"> </span> beta11=0,</div><div><span style="white-space:pre-wrap"> </span> beta12=0,</div><div><span style="white-space:pre-wrap"> </span> beta13=0,</div>
<div><span style="white-space:pre-wrap"> </span> beta14=0,</div><div><span style="white-space:pre-wrap"> </span> beta15=0,</div><div><span style="white-space:pre-wrap"> </span> beta16=0,</div><div><span style="white-space:pre-wrap"> </span> beta17=0,</div>
<div><span style="white-space:pre-wrap"> </span> beta18=0,</div><div><span style="white-space:pre-wrap"> </span> beta19=0,</div><div><span style="white-space:pre-wrap"> </span> beta20=0,</div><div><span style="white-space:pre-wrap"> </span> beta21=0,</div>
<div><span style="white-space:pre-wrap"> </span> beta22=0,</div><div><span style="white-space:pre-wrap"> </span> beta23=0,</div><div><span style="white-space:pre-wrap"> </span> beta24=0)</div><div><br></div><div>
#chamar o modelo no jags</div><div>morfo.m <- jags.model("morfo.txt",data=lddados,inicio,n.chains=1,n.adapt=1000)</div><div><br></div></div><div style="font-family:arial,sans-serif;font-size:13px">Abraço,</div>
<div style="font-family:arial,sans-serif;font-size:13px">Gisele</div></div></div>