30 Assignment 6

Due 11:59pm Sunday, March 1

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_Assignment6. 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):

[yij|zi,aj]={0ifzi=0Bern(aj)ifzi=1, where yij is the ith individual (persons) test result for the jth test. The zi is the true rabies status for the ith individual. The aj is the true positive rate for the jth 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 y1,1=0 and y1,2=0 where j=1 was the rapid test and j=2 was the PCR test.

Because the no rabies test is 100% accurate, the zi 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”

[zi|p]=Bern(p) where p is the probability the ith 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]=Beta(αp,βp) with αp=1 and βp=100. For a1, which is the true positive rate for the rapid test assume [a1]=Beta(αa1,βa1) with αa1=80 and βa1=20. For a2, which is the true positive rate for the PCR test assume [a2]=Beta(αa2,βa2) with αa2=200 and βa1=2.

  1. Plot the priors for p, a1, and a2. Write 4-5 sentences that comments on the appropriateness of of these priors for the rabies data example. Recall that the manufacture said that rapid test and PCR test had a true positive rate of 0.80 and 0.99 respectively. Remember that priors are just another model assumption. Assumptions are needed to analyze data and make inference (i.e., to infer from the tests if I have rabies or not).Thus I am asking you to evaluate how reasonable a portion of my assumptions are before you analyize the data.

  2. Write out (i.e., with pencil and paper) and sketch of the MCMC algorithm you will use to fit the fit the hierarchical Bayesian model described above to my rabies test results. Remember that fitting the model to my rabies data means that you need to sample from (or find analytically) [p,z1,a1,a2|y1,1,y1,2].

  3. Fit the hierarchical Bayesian model to my rabies test results (i.e., y1,1=0 and y1,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.

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

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

  6. Using your results from 2, make a histogram representation of the distribution [a1|y1,1,y1,2] (see pg. 541 in BBM2L). Make sure to label the label the axes appropriately.

  7. Using your results from 2, make a histogram representation of the distribution [a2|y1,1,y1,2] (see pg. 541 in BBM2L). Make sure to label the label the axes appropriately.

  8. Using words and numerical results (e.g., approximations of E(z1|y1,1,y1,2) and E(p|y1,1,y1,2)), write 5-7 sentences that summarizes the results and inferences you can make using the hierarchical Bayesian model that was fit to my rabies data.