model { for (i in 1:nmd) { # nmd = number of MDs participating x[i] ~ dbin(p[i],n[i]) # likelihood function for data for each MD logit(p[i]) <- z[i] # Logit transform z[i] ~ dnorm(mu,tau) # Logit of probabilities follow normal distribution } mu ~ dnorm(0,0.001) # Prior distribution for mu tau ~ dgamma(0.001,0.001) # Prior distribution for tau y ~ dnorm(mu, tau) # Predictive distribution for rate sigma <- 1/sqrt(tau) # SD on the logit scale w <- exp(y)/(1+exp(y)) # Predictive dist back on p-scale } # Data list(n=c( 20, 6, 24, 13, 12, 4, 24, 12, 18), x=c( 19, 5, 22, 12, 11, 4, 23, 12, 16), nmd=9) # Inits list(mu=0, tau=1) # Results | node | mean | sd | MC error | 2.5% | median | 97.5% | start | sample | | mu | 2.642 | 0.3716 | 0.0294 | 1.973 | 2.63 | 3.357 | 1001 | 5000 | | tau | 215.9 | 403.8 | 21.61 | 1.189 | 51.67 | 1447.0 | 1001 | 5000 | | sigma | 0.2245 | 0.2467 | 0.01485 | 0.02631 | 0.1393 | 0.9187 | 1001 | 5000 | | p[1] | 0.9301 | 0.02673 | 0.0018 | 0.8693 | 0.9332 | 0.9718 | 1001 | 5000 | | p[2] | 0.9242 | 0.03447 | 0.002022 | 0.8463 | 0.9294 | 0.9689 | 1001 | 5000 | | p[3] | 0.9277 | 0.0266 | 0.001763 | 0.8665 | 0.9316 | 0.9684 | 1001 | 5000 | | p[4] | 0.9281 | 0.02856 | 0.001852 | 0.8598 | 0.9321 | 0.9712 | 1001 | 5000 | | p[5] | 0.9279 | 0.0286 | 0.001851 | 0.8635 | 0.9319 | 0.9721 | 1001 | 5000 | | p[6] | 0.9293 | 0.02987 | 0.001896 | 0.8636 | 0.9333 | 0.9758 | 1001 | 5000 | | p[7] | 0.9313 | 0.02574 | 0.001803 | 0.8745 | 0.9343 | 0.9739 | 1001 | 5000 | | p[8] | 0.932 | 0.02688 | 0.001838 | 0.8748 | 0.9347 | 0.9779 | 1001 | 5000 | | p[9] | 0.9257 | 0.0288 | 0.001872 | 0.8595 | 0.93 | 0.9677 | 1001 | 5000 | | w | 0.927 | 0.03535 | 0.001954 | 0.8524 | 0.9324 | 0.9725 | 1001 | 5000 | | y | 2.638 | 0.4917 | 0.02993 | 1.753 | 2.624 | 3.565 | 1001 | 5000 |