29 Assignment 5

Due 11:59pm Wednesday, February 22

The purpose of this assignment is to explore and reinforce concepts in Chapters 4 & 6, as well as selected topics from Chapters 10 & 23 of Bringing Bayesian Models to Life.

You may complete this assignment with a partner (i.e., max group size of 2 people). If you chose to work with a partner you only need to submit one assignment, but please make sure both of your names are on it. You may participate in a learning group of any size to complete the assignment, but please submit your own work.

Make sure to show all of your work and computer code, so that your mathematical and numerical results are easily reproducible. In the most basic sense, this is equivalent to “showing your work” as you would with pencil and paper in a mathematics course.

Please save the file as a pdf and name it Yourlastname_Assignment5. Upload this file to Canvas.

In class we built a hierarchical Bayesian model for the rabies test results. For this model, we assumed the following “data model” for the two rabies test results (rapid and PCR):

\[[y_{ij}|z_i]=\begin{cases} 0 & \text{if} & z_i=0 \\ \text{Bern(}a_j) & \text{if} & z_i=1 \end{cases},\] where \(y_{ij}\) is the \(i^\text{th}\) individual (persons) test result for the \(j^\text{th}\) test. The \(z_i\) is the true rabies status for the \(i^\text{th}\) individual. The \(a_j\) is the true positive rate for the \(j^\text{th}\) test type (i.e., the probability the test returns a rabies positive results if the bat has rabies). In this model \(i=1,2,...n\) and \(j=1,2,...J\). Remember, that in class we found out the data for my test results was \(y_{1,1}=0\) and \(y_{1,2}=0\) where \(j=1\) was the rapid test and \(j=2\) was the PCR test. The rapid and PCR test had a true positive rate of 0.80 and 0.99 respectively (i.e., \(a_1=0.80\) and \(a_2=0.99\)).

Because the no rabies test is 100% accurate, the \(z_i\) is a unobservable random variable. These are also known as “latent” or “hidden states” in the hierarchical modeling literature. In our example, we assume the following “process model”

\[[z_i|p]=\text{Bern}(p)\] where \(p\) is the probability the \(i^\text{th}\) bat has rabies (also known as the prevalence rate in the disease modelling literature).

To fully specify a Bayesian model, we have to assume models for all unknowns. Typically these are called parameters and we assume prior distributions for these. For \(p\) we assumed \([p]=\text{Beta}(\alpha_p,\beta_p)\) with \(\alpha_p=1\) and \(\beta_p=1\).

  1. Using the R code I provided and demonstrated in class. Fit the hierarchical Bayesian model to my test results (i.e., \(y_{1,1}=0\) and \(y_{1,2}=0\)). For the MCMC algorithm, make sure to determine the appropriate burn-in interval and number of samples. Make sure to provide the code you used to fit the model.

  2. Using your results from 1, make a histogram representation of the distribution \([z_1|y_{1,1},y_{1,2}]\) This problem uses automatic marginalization (see pg. 541 in BBM2L). Make sure to label the axes appropriately.

  3. Using your results from 2, make a histogram representation of the distribution \([p|y_{1,1},y_{1,2}]\) (see pg. 541 in BBM2L). Make sure to label the axes appropriately.

  4. Using words and numerical results (e.g., approximations of \(E(z_1|y_{1,1},y_{1,2})\) and \(E(p|y_{1,1},y_{1,2})\)), write 4-5 sentences that summarizes the results and inferences you can make using the hierarchical Bayesian model that was fit to my rabies data.

  5. As we discussed in class, the assumption implied by the prior \([p]=\text{Beta}(\alpha_p,\beta_p)\) with \(\alpha_p=1\) and \(\beta_p=1\) is not reasonable. We know a lot more about rabies than to assume that the prevalence of rabies is between zero and one with equal likelihood. Propose a new prior that incorporates our prior knowledge about rabies. This will require you to do a quick search of the scientific literature on rabies. Don’t spend too much time trying to propose a reasonable prior.

  6. Repeat question #1 using the hierarchical Bayesian model with your new prior proposed in question #5.

  7. Repeat question #2 using the hierarchical Bayesian model with your new prior proposed in question #5.

  8. Repeat question #3 using the hierarchical Bayesian model with your new prior proposed in question #5.

  9. Repeat question #4 using the hierarchical Bayesian model with your new prior proposed in question #5.