title: Error in jags.model
body: <p>I'm new to R and JAGS, and not even very experienced with programming. </p>
  
  <p>I'm trying to set up a hierarchical model for some data, but I get this error:</p>
  
  <pre><code>####error in line above:
  Error in jags.model(file = "modelControl.txt", data = dataList, inits = 
  initsList,  : 
    RUNTIME ERROR:
  Cannot insert node into beta1[1:158]. Dimension mismatch
  </code></pre>
  
  <p>At the end of running the code below.  What am I doing wrong?  How can I avoid the error?</p>
  
  <pre><code>#declaration
  y=as.numeric(PANSS[treat == 0]) #treat == 0 indicates control group
  x=as.numeric(time[treat == 0])
  meanYcontrol = mean(PANSS[treat == 0])
  sdYcontrol = sd(PANSS[treat == 0])
  s = pp[treat==0]
  
  #data list
  dataList = list(
    y = y,
    x = x,
    Ntotal = length(y),
    Nsubj = length(y)/6 , #each subject had 6 test moments
    s = s
  )
  #model
  modelString = "
  model {
  for ( i in 1:Ntotal ) {
  y[i] ~ dnorm( beta0[s[i]] + beta1[s[i]] * x[i,1], 1/sigma^2 ) 
  }
  for ( j in 1:Nsubj ) {
  beta0[j] ~ dnorm( beta0mu , 1/(beta0sigma)^2 ) 
  beta1[j] ~ dnorm( beta1mu , 1/(beta1sigma)^2 )
  }
  #vague priors
  beta0 ~ dnorm( 0, 1/(10)^5 )  
  beta1 ~ dt( 0, 1, 1 ) #Cauchy distribution
  beta0sigma ~ dunif( 1.0E-5, 1.0E+5 )
  beta1sigma ~ dunif( 1.0E-5, 1.0E+5 )
  sigma ~ dunif( 1.0E-5, 1.0E+5 )
  nu = nuMinusOne+1
  nuMinusOne ~ dexp(1/29)
  }
  "
  
   #write model to text file
  writeLines(modelString, con="modelControl.txt")
  
  #initialization chains
  beta0Init = meanYcontrol
  beta1Init = 0
  sigmaInit = sdYcontrol
  initsList = list(beta0=beta0Init, beta1=beta1Init, sigma=sigmaInit)
  
  #run chains
  parameters = c("beta0", "beta1", "sigma") #parameters to be monitored
  numSavedSteps = 7500 #number of steps in chain to save
  adaptSteps = 1000  #number of steps to tune the samplers
  burnInSteps = 500 #number of steps to burn-in the samplers
  thinSteps = 1 #number of steps to keep (1=keep every step)
  nChains = 3 #number of chains to run
  nIter = ceiling(numSavedSteps / nChains) #number of steps per chain
  
  jagsModel = jags.model(file="modelControl.txt", data=dataList, inits = 
  initsList, n.chains=nChains, n.adapt=adaptSteps)
  </code></pre>