title: Strange Errors in my OpenBUGS code (using R2OpenBUGS)
body: <p>I've written a Weibull survival code in <code>OpenBUGS</code> using the <code>R2OpenBUGS</code> package in <code>R</code>. After hours of debugging, I still get the errors below:</p>
  
  <blockquote>
    <p>this component of node is not stochastic Beta0[1] error pos 30</p>
    
    <p>this component of node is not stochastic Beta0[1] error pos 31</p>
    
    <p>this component of node is not stochastic Beta0[1] error pos 30</p>
    
    <p>update error for node  algorithm slice updater error can not sample node  too many iterations</p>
    
    <p>inference can not be made when sampler is in adaptive phase</p>
  </blockquote>
  
  <p>Here is my full code along with the initial values:</p>
  
  <pre><code>#--------------
  # Model Code --
  #--------------
  linemodel &lt;- function(){
    for(i in 1:N){ 
      for (j in 1:M){
        weibSamp[i,j] ~ dweib(tau, gamma[i]) %_% I(weibCens[i,j],)
      }
      gamma[i] &lt;- exp(Beta0[i] + Beta1*X[i])
      S[i] ~ dcat(pi[])
      Beta0[i] &lt;- Beta0Pool[S[i]]
      for (j in 1:C){
        SC[i,j] &lt;- equals(j, S[i])
      }
    }
    # Precision Parameter for DP:
    alpha ~ dgamma(0.1, 0.1)
  
    # Let's construct the DP:
    p[1] &lt;- r[1]
    for (j in 2:C){
      p[j] &lt;- r[j]*(1 - r[j - 1])*p[j-1]/r[j-1]
    }
    p.sum &lt;- sum(p[])
    for (j in 1:C){
      Beta0Pool[j] ~ dnorm(A, B)
      r[j] ~ dbeta(1, alpha)
      # scaling to ensure p sums to 1
      pi[j] &lt;- p[j]/p.sum
    }
  
    # Hyper priors A and B inside of DP (for G0)
    A ~ dnorm(0, 0.01)
    B ~ dgamma(0.1, 0.1)
  
    # Total number of clusters:
    K &lt;- sum(cl[])
    for (j in 1:C){
     sumSC[j] &lt;- sum(SC[,j])
      cl[j] &lt;- step(sumSC[j] - 1)
    }
    tau ~ dexp(0.001)
    Beta1 ~ dnorm(0, 0.01)
  }
  
  #---------------
  # Initializing -
  #---------------
  lineinits &lt;- function(){
    list(tau = runif(1, 0.1, 3), Beta0 = rnorm(N, 0, 2), Beta1 = rnorm(1, 0,
         2), alpha = 2, A = 0, B = 2)
  }
  
  #------------------------------------
  # Time to get OpenBUGS run the code -
  #------------------------------------
  library(coda)
  lineout &lt;- bugs(data, lineinits, c("tau", "Beta0", "Beta1"), linemodel, 
              n.iter = 1000, n.burnin = 200, n.thin = 1, codaPkg = T, 
              debug = T)
  </code></pre>