28 Assignment 4

Due 11:59pm Sunday February 12

The purpose of this assignment is to explore and reinforce concepts in Chapter 4 and Chapter 6 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_Assignment4. Upload this file to Canvas.

For all questions in this assignment let \([a]\) be a beta distribution with \(\alpha=2\) and \(\beta=1\) (i.e., \(a\sim\text{beta}(\alpha=2,\beta=1)\)).

  1. Use a Metropolis-Hastings algorithm to draw 5000 samples from \([a]\) (see bottom of pg. 25 in BBM2L). For this example, use a so-called walk or Metropolis proposal (see section 4.3 on pgs. 33-35) with \(\sigma^2_{\text{tune}}=0.0001\). Before you start this problem write out and simplify the Metropolis-Hastings ratio. Show all of your steps for this.

  2. Discard the first 1000 samples from the 5000 Monte Carlo samples you drew in question 1. Then calculate the mean of the remaining 4000 samples you drew in question 1. Although it might not be obvious, you are implicitly approximating an integral. Write out the integral that you are approximating.

  3. Use a Metropolis-Hastings algorithm to draw 5000 samples from \([a]\) (see bottom of pg. 25 in BBM2L). For this example, use a so-called walk or Metropolis proposal (see section 4.3 on pgs. 33-35) with \(\sigma^2_{\text{tune}}=0.25\). Before you start this problem write out and simplify the Metropolis-Hastings ratio. Show all of your steps for this.

  4. Discard the first 1000 samples from the 5000 Monte Carlo samples you drew in question 3. Then calculate the mean of the remaining 4000 samples you drew in question 3. Although it might not be obvious, you are implicitly approximating an integral. Write out the integral that you are approximating.

  5. Use a Metropolis-Hastings algorithm to draw 5000 samples from \([a]\) (see bottom of pg. 25 in BBM2L). For this example, use a so-called walk or Metropolis proposal (see section 4.3 on pgs. 33-35) with \(\sigma^2_{\text{tune}}=10\). Before you start this problem write out and simplify the Metropolis-Hastings ratio. Show all of your steps for this.

  6. Discard the first 1000 samples from the 5000 Monte Carlo samples you drew in question 5. Then calculate the mean of the remaining 4000 samples you drew in question 3. Although it might not be obvious, you are implicitly approximating an integral. Write out the integral that you are approximating.

  7. Compare the numerical values of the Monte Carlo approximation to the integrals in questions 2, 4, and 6. Write 3-5 sentences describing the differences (if any) between the approximation accuracy of the integrals with the three different proposal distributions.