1
$\begingroup$

I am doing bayesian analysis in which my outcome variable is binary (perinatal mortality). I have a couple of explanatory variables such as gender, birth order, maternal education, residence, maternal weight, birth interval etc. I am new in bayesian analysis but I have invested a lot in learning it. now I am trying to reproduce one example which exactly looks similar to my model using rjags. Unfortunately I am getting this error "Error parsing model file: syntax error on line 20 near ""

Can anyone help me where do I go wrong. These are my codes:

logistic_model <- "model{

   # Likelihood

   for(i in 1:n){
    Y[i] ~ dbern(q[i])
    logit(q[i]) <- beta[1] + beta[2]*X[i,1] + beta[3]*X[i,2] + 
                   beta[4]*X[i,3] + beta[5]*X[i,4] + beta[6]*X[i,5]+
                   beta[7]*X[i,6]+beta[8]*X[i,7]+beta[9]*X[i,8]+beta[10]*X[i,9]+
                   beta[11]*X[i,10]+beta[12]*X[i,11]+beta[13]*X[i,12]
                   
    
   #Priors

   for(j in 1:13){
    beta[j] ~ dbeta(2,2)
   }

  }"
dat<-list(Y=Y,n=n,X=X)

model<-jags.model(textConnection(logistic_model),data = dat,n.chains = 3,quiet = TRUE)
update(model,10000,progress.bar="none")
$\endgroup$

Browse other questions tagged or ask your own question.