
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

Does not have to be turned in. Problems like this may appear on the final.1. This question is a continuation of your first homework for this class.Refer to section 1.4 (pp. 9-11) in Gelman
et al.^ The question of interest is whether or not the woman is a carrier of the hemophilia gene.
(If you no longer have the
photocopy of this, see me.)Suppose the woman has 1 son, whose hemophilia status is
y^ = 0.^ (This is different
from the outcomes discussed in the book.)Compute:(a) prior odds in favor of
θ^ = 0 vs.^ θ^ = 1 (b) Bayes factor in favor of
θ^ = 0 vs.^ θ^ = 1 (c) posterior odds in favor of
θ^ = 0 vs.^ θ^ = 1
I have added 4 lines to the program.
Refer to the code and
output to answer the following questions (just a sentence or two for each).(a) Explain the meaning of the following new nodes:i. ypredii. residiii. presidiv. pppv(b) What could you learn by monitoring ”pppv”?(c) Does the output suggest any problems with model fit? model{for( i in 1 : batches ) {m[i] ~ dnorm(theta, tau.btw)for( j in 1 : samples ) {y[i , j] ~ dnorm(m[i], tau.with)ypred[i,j] ~ dnorm(m[i], tau.with)resid[i,j] <- abs(y[i,j] - m[i])presid[i,j] <- abs(ypred[i,j] - m[i])}large[i] <- ranked(resid[i,], samples)largepred[i] <- ranked(presid[i,], samples)pppv[i] <- step(large[i] - largepred[i])}
sigma2.with <- 1 / tau.withsigma2.btw <- 1 / tau.btwtau.with ~ dgamma(0.001, 0.001)tau.btw ~ dgamma(0.001, 0.001)theta ~ dnorm(0.0, 1.0E-10)} node^ mean^ sd
MC error^ 2.5% median 97.5% start sample m[1] 1515.0 20.31 0.
m[2] 1528.0 18.62 0.
m[3] 1548.0 22.12 0.
m[4] 1511.0 21.42 0.
m[5] 1569.0 30.38 1.
m[6] 1495.0 27.22 0.
pppv[1] 0.561 0.4963 0.
pppv[2] 0.1466 0.3537 0.
pppv[3] 0.3195 0.4663 0.
pppv[4] 0.6383 0.4805 0.
pppv[5] 0.5282 0.4992 0.
pppv[6] 0.2517 0.434 0.
sigma2.btw 2125.0 3716.0 65.
sigma2.with 3083.0 1125.0 31.
First use the model, data, and initial values exactly as given in the“Rats” example in Volume 1 of examples.
Then use the model, data, and initial values as given in the “Birats example in Volume 2. In both cases, run at least 1000burn-in iterations before you Set the DIC. Then use output for the DIC based on atleast 10000 additional iterations. Turn in the tables of DIC results for both models,and answer the following questions:(a) What is the estimated number of free parameters in the “Rats” model? In the“Birats” model? What could explain the difference between the two estimates?(b) Is one model strongly preferred over the other after the penalty for model com-plexity is taken into account? Justify your answer.