29 Assignment 3

Assignment 3 is be completed individually or with a partner (i.e., the maximum group size is two). Please submit the assignment as a single pdf or html file (one file per individual/group). Save the file as Yourlastname_Assignment3 (e.g., Hefley_Assignment3). Make sure to show your work in R to ensure that I can reproduce your results (e.g., figures, calculations, etc). Upload your completed assignment to Canvas before 5 pm on Tuesday 9/29/20.

29.1 Motivation

Assignment 3 is designed to give you experience with sampling-based approaches to fit Bayesian hierarchical models to spatio-temporal data.

29.2 Problems

29.3 Part 1

Suppose that we lived in a world where there was a test for COVID-19 that was 100% accurate (i.e., a test with no false-negatives and no false positives). In this world, a fictitious version of me decided to get tested for COVID-19 last week.

  1. Let the process model be [y|ϕ]=Bernoulli(ϕ) and the parameter model be [ϕ]=Beta(α,β). Use Bayes’ theorem to find [ϕ|y]. Show all of your work. You can insert a image of your work if you want to use pencil and paper rather than typesetting it. Note that because the test is 100% accurate there is no need for a data model when using the Bayesian hierarchical modeling framework.

  2. Prior to being tested for COVID-19, I was unsure if I was infected. For the Bayesian model from #1, determine the exact parameter model (i.e., the values of the α and β) that represent this prior knowledge.

  3. My test results came back negative. Using the data from my test results and your results from problem #1 and #2, obtain 1,000 samples from [ϕ|y]. With these samples, represent [ϕ|y] using a histogram. Make sure to put appropriate axis labels on this histogram.

29.4 Part 2

For most Bayesian models, you won’t be able to find the posterior distribution (i.e., [ϕ|y]) using mathematical tools. Instead you will only be able to obtain samples using computational tools. Below you will use two different algorithms to obtain samples from [ϕ|y].

  1. Use your results from problem 1-3 and rejection sampling to obtain 1,000 samples from [ϕ|y]. With these samples, represent [ϕ|y] using a histogram. Make sure to put appropriate axis labels on this histogram.

  2. Use your results from problem 1-3 and a Metropolis or Metropolis-Hastings algorithm to obtain 1,000 samples from [ϕ|y]. With these samples, represent [ϕ|y] using a histogram. Make sure to put appropriate axis labels on this histogram.

29.5 Part 3

For most tests, there is a probability of obtaining a false-negative test result. Because there is the potential for false-negative test results, we need to include a data model in our Bayesian hierarchical model. To accommodate the potential for false-negatives use the data model [z|y]={Bernoulli(0.9)ify=10ify=0 where z is my test result (which was negative), 0.9 is the probability that a true positive (i.e., y=1) result in a positive test result (i.e., z=1).

  1. Obtain samples from the posterior distribution [y,ϕ|z]. With these samples, represent [y|z] using one histogram and [ϕ|z] with another histogram. Make sure to put appropriate axis labels on this histogram.

  2. Given my test results, what is the probability I have COVID-19?