Instructions

This assignment involves one parameter models and Monte Carlo approximations. 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 2.

Questions

  1. Using the inverse cdf method, generate 1,000 random realizations from the Beta(5,10) distribution truncated to the interval (0.4,0.75).
    • What is the mean of your random draws (rounded to 2 decimal places)?
    • What is the variance of your random draws (rounded to 2 decimal places)?
  2. Let \[y_1,\ldots,y_n \overset{iid}{\sim} \textrm{Ga}(a,b)\] where a is known (so we only wish to infer b).
    • Find the conjugate family of priors for b.
    • Find the corresponding posterior given the prior you identified in the previous part.
    • Give an interpretation of the prior parameters as things like “prior mean”, “prior variance”, “prior sample size”, etc.
  3. Hoff 3.3

  4. Hoff 4.1

  5. How many samples is enough? Recall the birth rates example from the slides.
    • Sample from the posterior distribution for women who are college educated using \(m\) = 10, 100, and 1000 Monte Carlo samples. For each \(m\), make a plot of the random draws and on the same plot, mark the points corresponding to the posterior mean and the 95% equal-tailed credible interval (quantile-based). How do those compare to the true posterior mean and 95% quantile-based CI?

    • In addition, calculate the posterior probability that \(\theta_2 < 1.5\) in each case.

    • How large should \(m\) be if \(95\%\) of the time we want the difference between the Monte Carlo estimate of the posterior mean and the true posterior mean (which we know in this case) to be \(\leq 0.001\)?

  1. Hoff 4.8

    You can find the data mentioned in the question here: http://www2.stat.duke.edu/~pdh10/FCBS/Exercises/. Clearly, you don’t need to download and load the data, you can just enter it manually in R.

Grading

20 points.