model {
tau ~ dgamma(20, 2000)
sigma <- 1/sqrt(tau) theta ~ dnorm(5, 0.25) n <- 2*pow((1.28 + 1.96)*sigma/theta, 2) # n for 90% power power <- phi(sqrt(84/2)*theta/sigma - 1.96) # power for n = 84 p70 <- step(power - 0.7) # Pr(power > 70%)
}

node mean sd MC error 2.5% median 97.5% start sample
n 38740.0 2.533E+6 25170.0 24.73 87.93 1487.0 1 10000
p70 0.7012 0.4577 0.004538 0.0 1.0 1.0 1 10000
power 0.7739 0.2605 0.002506 0.1151 0.8863 1.0 1 10000