"Comma expected" error in OpenBUGS

I am trying to fit a model using OpenBUGS. Here is the code:

model {
    # N observations
    for (i in 1:N) {
        y[i] ~ dbin(p.bound[i],1)
        p.bound[i]<-max(0,min(1,p[i]))
        logit(p[i])<-Xbeta[i]
Xbeta[i] <- a[sp[i]]-0.5*pow(((X1[i]-opt1[sp[i]])/tol1[sp[i]])+((X2[i]-opt2[sp[i]])/tol2[sp[i]])+((X3[i]-opt3[sp[i]])/tol3[sp[i]]))
    }
    for (j in 1:n.sp) {
    a[j] ~ dnorm(a.hat[j],tau.a)
    a.hat[j]<-mu.a 

        opt1[j] ~ dnorm(opt.hat1[j],tau.opt1) 
          opt.hat1[j]<-mu.opt1

        tol1[j] ~ dnorm(tol.hat1[j],tau.tol1)       
          tol.hat1[j]<-mu.tol1 

        opt2[j] ~ dnorm(opt.hat2[j],tau.opt2) 
          opt.hat2[j]<-mu.opt2

        tol2[j] ~ dnorm(tol.hat2[j],tau.tol2)       
          tol.hat2[j]<-mu.tol2

        opt3[j] ~ dnorm(opt.hat3[j],tau.opt3) 
          opt.hat3[j]<-mu.opt3
        tol3[j] ~ dnorm(tol.hat3[j],tau.tol3)       
         tol.hat3[j]<-mu.tol3

    } 
    mu.a~dnorm(0,0.0001)
    mu.opt1~dnorm(0,0.0001)
    mu.tol1~dunif(0.04,37)

  mu.opt2~dnorm(0,0.0001)
    mu.tol2~dunif(0.04,37)

  mu.opt3~dnorm(0,0.0001)
    mu.tol3~dunif(0.04,37)


     tau.a<-pow(sigma.a,-2)
     sigma.a~dunif(0,100)
     tau.opt1<-pow(sigma.opt1,-2)
     sigma.opt1~dunif(0,100)
     tau.opt2<-pow(sigma.opt2,-2)
     sigma.opt2~dunif(0,100)

         tau.opt3<-pow(sigma.opt3,-2)
     sigma.opt3~dunif(0,100)

     tau.tol1<-pow(sigma.tol1,-2)
     sigma.tol1~dunif(0,100)


         tau.tol2<-pow(sigma.tol2,-2)
     sigma.to2~dunif(0,100)

         tau.tol3<-pow(sigma.tol3,-2)
     sigma.tol3~dunif(0,100)


   }

      

But, when I run this code, I get an expected comma error. If someone can help me solve this problem that would be great.

+3


source to share


1 answer


Error in power supply function. From the BUGS manual .

pow(e1, e2)

e1^e2

At this point, you have e1

;



Xbeta[i] <- a[sp[i]]-0.5*pow(e1)

where e1 = ((X1[i]-opt1[sp[i]])/...

.

+2


source







All Articles