Ex 6.10 N-of-1 analysis - very robust to alternative priors on tau. Just uniform reported below. model; { for(k in 1:23){ # j indexes individual dummy[k]<-id[k]+dose[k] # just to mention all data for(j in 1:n[k]){ # k indexes observation y[k,j] ~ dnorm(theta[k],inv.sigma2[k]) } theta[k] ~ dnorm(mu.theta, inv.tau.theta2) # next 2 lines used in dose-adjustment model # theta[k] <- theta.adj[k]+ # beta*(log.dose[k]-mean(log.dose[1:23])) # theta.adj[k] ~ dnorm(mu.theta, inv.tau.theta2) P[k] <- step(theta[k]) # prob(effect > 0) inv.sigma2[k] ~ dlnorm(mu.sigma,inv.tau.sigma2)# log-normal precisions } mu.theta ~ dunif(-10,10) # uniform on soveral mean beta ~ dunif(-10,10) # used in dose-adjustment model mu.sigma ~ dunif(-10,10) # uniform on mean log-precision inv.tau.sigma2 <- 1/(tau.sigma*tau.sigma) tau.sigma ~ dunif(0,10) # uniform on sd of log-precisions P.pop <- step(mu.theta) P.pop.diff <- step(mu.theta-0.5) mean.var<- exp(mu.sigma+tau.sigma*tau.sigma/2) # j again indexes individual for(j in 1:23){ log.dose[j] <- log(dose[j]) # log of dose s[j] <- sd(y[j,1:n[j]]) # empirical sd prec2[j] <- n[j]/(s[j]*s[j]) # empirical 1/se^2 } s02 <- 1/mean(prec2[1:23]) # mean for shrinkage sigma2 <- s02 * mean(n[1:23]) # mean for ICC # Prior: Uniform(0,50) on tau tau.theta ~ dunif(0,50) tau.theta2 <- tau.theta * tau.theta inv.tau.theta2 <- 1/tau.theta2 }