Instructions

Please make sure your final output file is a pdf document. You can submit handwritten solutions for non-programming exercises or type them using R Markdown, LaTeX or any other word processor. All programming exercises must be done in R, typed up clearly and with all code attached. Submissions should be made on gradescope: go to Assignments \(\rightarrow\) Homework 1.

Questions

  1. There are three coins in a bag; two fair coins (probability of heads = probability of tails) and one fake coin (probability of heads = 1).

    • Part (a): You reach in and select one coin at random and throw it in the air. What is the probability that it lands on heads?
      (1 point)
    • Part (b): You reach in and select one coin at random and throw it in the air and get heads. What is the probability that it is the fake coin?
      (1.5 points)
  2. Hoff 2.3

    • Part (a): 2 points
    • Part (b): 2 points
    • Part (c): 1 point
  3. Show that the posterior variance of the beta-binomial model can be written as \[\mathbb{V}(\theta | y) = \dfrac{\mathbb{E}(\theta | y)\mathbb{E}(1-\theta | y)}{a+b+n+1}.\]
    (2.5 points)

  4. Hoff 3.1.

    • Part (a): 0.5 points
    • Part (b): 1 point
    • Part (c): 1 point
    • Part (d): 1.5 points
    • Part (e): 2 points

    Don’t work out part (a), just say what the correct sampling distribution is (you should already know) and move on to the remaining parts.

  5. Using the inverse cdf method, generate 1,000 random realizations from the Beta(5,10) distribution truncated to the interval (0.4,0.75).

    • Part (a): What is the mean of your random draws (rounded to 2 decimal places)?
      (0.5 points)
    • Part (b): What is the variance of your random draws (rounded to 4 decimal places)?
      (0.5 points)
  6. Continuation of the “new agent” example from class. For each of the priors (that is, Beta(1,666), Beta(0.05,33.33), Beta(1.6, 407.4), Beta(1.05, 497), and Unif(0,0.1)), how many trials would we need, assuming no adverse reactions, to be 95% sure that the new agent is as safe as (or safer than) the old one? That is, what value of \(n\) is required to ensure that \(\Pr(\theta_N \leq 0.0015| y) = 0.95\)?
    (3 points)

    Feel free to derive this by hand but you can save some time by doing it in R!

  7. Hoff 3.2.
    (Not graded. Attempt for practice but you don’t need to submit!)

    Refer back to pages 5 to 7 of the Hoff book (the section on sensitivity analysis) if you are not sure what to do.

Grading

Total: 20 points.