Chapter 7 Exercises
Asthma with treatment effect
Solutions
In Example 7.2.3 (asthma with treatment effect), repeat the analysis with alternative prior distributions. For the baseline (treatment 0) log odds, use standard logistic priors, which correspond to uniform priors on the scale of probabilities. Also suppose we are 95\% certain that the odds ratio is less than 5, and derive the corresponding normal prior distribution, centred around zero, for the log odds ratio. How are the posterior distributions of the odds ratio and the treatment 0 transition probabilities, affected?
For the log odds ratio, obtain the prior precision tau = 1/sigma to solve P(standard normal < log(5) / sigma) = 0.5, giving sigma = log(5) / invphi(0.95) = 0.9784688, and tau = 1.044494.
model {
for(i in 1:2){
count[i,1:5] ~ dmulti(q[i,1:5], M[i])
for (r in 1:5) {
q[i,r] <- phi[i, r] / sum(phi[i, ])
log(phi[i, r]) <- a[r] + b.treat[r] * treat[i]
}
}
# for (r in 2:5){ a[r] ~ dnorm(0, 0.00001) } # old prior
for (r in 2:5){ a[r] ~ dlogis(0, 1) } # new prior
a[1] <- 0
b.treat[1] <- 0
# b.treat[2] ~ dnorm(0, 0.00001) # old prior
b.treat[2] ~ dnorm(0, 1.044494) # new prior
or.treat <- exp(b.treat[2])
for (r in 3:5) { b.treat[r] <- 0 }
treat[1] <- 0
treat[2] <- 1
}
data
list(count=structure(.Data=c(210,60,0,1,1,
66,32,0,0,2),.Dim=c(2,5)),
M=c(272, 100),
)
inits
list(a = c(NA, 0, 0, 0, 0), b.treat = c(NA, 0, NA, NA, NA))
The posterior distribution of the log odds ratio is shrunk slightly towards zero to reflect the stronger prior information, but not substantially, since the prior is only weakly informative compared to the data. The "baseline" transition probabilities (under treatment 0) are hardly changed when the prior is changed.
Under new priors:
node mean sd MC error 2.5% median 97.5% start sample
or.treat 1.636 0.4215 0.004297 0.9657 1.582 2.61 4001 96000
q[1,1] 0.7562 0.02533 2.581E-4 0.7049 0.7568 0.8047 4001 96000
q[1,2] 0.2245 0.02498 2.56E-4 0.1769 0.2241 0.275 4001 96000
q[1,3] 0.002746 0.002739 1.898E-5 6.988E-5 0.001896 0.01015 4001 96000
q[1,4] 0.005488 0.003875 2.645E-5 6.419E-4 0.004619 0.01523 4001 96000
q[1,5] 0.01103 0.005455 3.728E-5 0.003106 0.01014 0.02395 4001 96000
q[2,1] 0.668 0.0446 3.28E-4 0.5777 0.6689 0.7517 4001 96000
q[2,2] 0.315 0.04523 3.33E-4 0.2302 0.314 0.4068 4001 96000
q[2,3] 0.002426 0.002426 1.675E-5 6.134E-5 0.001672 0.009007 4001 96000
q[2,4] 0.004846 0.003436 2.357E-5 5.699E-4 0.004066 0.01351 4001 96000
q[2,5] 0.00974 0.004851 3.319E-5 0.002726 0.008932 0.02132 4001 96000
Under original priors:
node mean sd MC error 2.5% median 97.5% start sample
or.treat 1.71 0.4517 0.004383 0.9911 1.655 2.75 4001 96000
q[1,1] 0.768 0.02522 2.599E-4 0.7175 0.7686 0.8159 4001 96000
q[1,2] 0.2208 0.02503 2.565E-4 0.1737 0.2201 0.2711 4001 96000
q[1,3] 5.483E-6 1.414E-4 8.109E-7 0.0 0.0 2.166E-7 4001 96000
q[1,4] 0.002771 0.002742 2.013E-5 6.661E-5 0.001954 0.01014 4001 96000
q[1,5] 0.008381 0.004769 3.21E-5 0.001788 0.007486 0.02 4001 96000
q[2,1] 0.6707 0.04562 3.196E-4 0.579 0.6719 0.7569 4001 96000
q[2,2] 0.3195 0.04604 3.212E-4 0.2329 0.3183 0.4124 4001 96000
q[2,3] 4.722E-6 1.226E-4 7.001E-7 0.0 0.0 1.861E-7 4001 96000
q[2,4] 0.002421 0.002405 1.78E-5 5.784E-5 0.001704 0.008948 4001 96000
q[2,5] 0.007317 0.004192 2.808E-5 0.001544 0.006514 0.01763 4001 96000