[R] rjags syntax error
Christopher David Desjardins
cddesjardins at gmail.com
Fri Apr 9 20:47:59 CEST 2010
Hi, I am getting the following error when I'm running jags.model()
> meas1 <- jags.model(file="measurement.bug",data=dat.test)
syntax error, unexpected '}', expecting ',' or ')'
Error in jags.model(file = "measurement.bug", data = dat.test) :
Parse error on line 1
Below is my JAGS model. Please cc me as I'm a digest subscriber if you
reply.
Thanks!
Chris
JAGS model ...
model {
for(i in 1:N){
##########################
# measurement equation model
##########################
for(j in 1:P){
y[i,j]~dnorm(mu[i,j],psi[j])
}
##########################
# alp[i] corresponds to the intercepts
##########################
mu[i,1]<-xi[i,1]+alp[1] ## Ext1
mu[i,2]<-lam[1]*xi[i,1]+alp[2]
mu[i,3]<-lam[2]*xi[i,1]+alp[3]
mu[i,4]<-xi[i,2]+alp[4] ## Soc1
mu[i,5]<-lam[3]*xi[i,2]+alp[5]
mu[i,6]<-lam[4]*xi[i,2]+alp[6]
mu[i,7]<-xi[i,3]+alp[7] ## Aca1
mu[i,8]<-lam[5]*xi[i,3]+alp[8]
mu[i,9]<-lam[6]*xi[i,3]+alp[9]
mu[i,10]<-xi[i,4]+alp[10] ## Ext2
mu[i,11]<-lam[7]*xi[i,4]+alp[11]
mu[i,12]<-lam[8]*xi[i,4]+alp[12]
mu[i,13]<-xi[i,5]+alp[13] ## Soc2
mu[i,14]<-lam[9]*xi[i,5]+alp[14]
mu[i,15]<-lam[10]*xi[i,5]+alp[15]
mu[i,16]<-xi[i,6]+alp[16] ## Aca2
mu[i,17]<-lam[11]*xi[i,6]+alp[17]
mu[i,18]<-lam[12]*xi[i,6]+alp[18]
mu[i,19]<-xi[i,7]+alp[19] ## Work2
mu[i,20]<-lam[13]*xi[i,7]+alp[20]
mu[i,21]<-lam[14]*xi[i,7]+alp[21]
mu[i,22]<-xi[i,8]+alp[22] ## Ext3
mu[i,23]<-lam[15]*xi[i,8]+alp[23]
mu[i,24]<-lam[16]*xi[i,8]+alp[24]
mu[i,25]<-xi[i,9]+alp[25] ## Soc3
mu[i,26]<-lam[17]*xi[i,9]+alp[26]
mu[i,27]<-lam[18]*xi[i,9]+alp[27]
mu[i,28]<-xi[i,10]+alp[28] ## Aca3
mu[i,29]<-lam[19]*xi[i,10]+alp[29]
mu[i,30]<-lam[20]*xi[i,10]+alp[30]
mu[i,31]<-xi[i,11]+alp[31] ## Work3
mu[i,32]<-lam[21]*xi[i,11]+alp[32]
mu[i,33]<-lam[22]*xi[i,11]+alp[3]
mu[i,34]<-xi[i,12]+alp[34] ## Ext4
mu[i,35]<-lam[23]*xi[i,12]+alp[35]
mu[i,36]<-lam[24]*xi[i,12]+alp[36]
mu[i,37]<-xi[i,13]+alp[37] ## Soc4
mu[i,38]<-lam[25]*xi[i,13]+alp[38]
mu[i,39]<-lam[26]*xi[i,13]+alp[39]
mu[i,40]<-xi[i,14]+alp[40] ## Aca4
mu[i,41]<-lam[27]*xi[i,14]+alp[41]
mu[i,42]<-lam[28]*xi[i,14]+alp[42]
mu[i,43]<-xi[i,15]+alp[43] ## Work4
mu[i,44]<-lam[29]*xi[i,15]+alp[44]
mu[i,45]<-lam[30]*xi[i,15]+alp[45]
xi[i,1:45]~dmnorm(u[1:15],phi[1:15,1:15])
}
for(j in 1:45){alp[j]~dnorm(0.0, 1.0)}
for(j in 1:30){lam[j]~dnorm(0.8,psi[j]}
for(j in 1:P){
psi[j]~dgamma(9.0, 4.0)
sgm[j]<-1/psi[j]
}
psd~dgamma(9.0, 4.0)
sgd<-1/psd
phi[1:3,1:3]~dwish(R[1:3,1:3], 5)
phx[1:3,1:3]<-inverse(phi[1:3,1:3])
}
More information about the R-help
mailing list