title: How to write model file for JAGS binomial using logit function
body: <p>I am working on an assignment using JAGS to model a binomial distribution who's <code>p</code> parameter is a function of another variable <code>d</code>.</p>
  
  <p>This is what I am trying to do:</p>
  
  <ol>
  <li>generate 10000 samples from the posterior for the two parameters alpha/beta</li>
  <li>produce samples to from the posterior predicted number of success when dist = 25 for 100 attempts</li>
  <li>calculate 95 credible interval for success rate at 25 feet distance</li>
  </ol>
  
  <p>I have written the model but it is giving an error.</p>
  
  <p>Below is the code I have already tried</p>
  
  <pre><code>#R-code
  distance=seq(from=2,to=20,by=1)
  Ntrys=c(1443,694,455,353,272,256,240,217,200,237,202,192,174,167,201,195,191,147,152)
  Nsucc=c(1346,577,337,208,149,136,111,69,67,75,52,46,54,28,27,31,33,20,24)
  
  psucc=Nsucc/Ntrys
  
  glm1.data=list(N=19, Nsucc=Nsucc,psucc=psucc,distance=distance)
  
  glm1.model=jags.model("glm1.model",glm1.data,n.chains=2)
  
  glm1.samps=coda.samples(glm1.model, variable.names=c("alpha", "beta"), 1e5)
  
  #model file
  model{ 
      for (i in 1:N){
              Nsucc[i] ~ dbern(psucc[i])
              log((psucc[i])/(1-psucc[i])) &lt;- alpha + beta*(distance[i])
      }
      alpha ~ dunif(-10,10)
      beta ~ dunif(-10,10)
  }
  </code></pre>
  
  <p>I get an error </p>
  
  <blockquote>
    <p>Error in jags.model("glm1.model", glm1.data, n.chains = 2) :<br>
      RUNTIME ERROR:<br>
    Compilation error on line 4.<br>
    pmiss[1] is a logical node and cannot be observed  </p>
  </blockquote>
  
  <p>I don't think the model file is even setup to do what I'm trying to do. </p>