Question: Binomial (unknown , n) beta/Poisson model. Refer to Problem 3.2. Find the conditional posterior distributions h( | n, x) and h(n | , x).
Binomial (unknown θ, n) ∧ beta/Poisson model. Refer to Problem 3.2. Find the conditional posterior distributions h(θ | n, x) and h(n | θ, x). As before, use x = 50, and (a0, b0) = (1, 4).
a. Describe and implement a Gibbs sampling algorithm to generate (nm, θm) ∼
h(n, θ | x). Plot the joint posterior h(n, θ | x), and plot on top of the same figure the simulated posterior draws (nm, θm), m = 1, . . . , 50 (connected by line segments showing the moves).
Hint: Use the R function sample(.) to generate from h(n | θ, x). When evaluating h(n | θ, x), evaluate the function first on the log scale over a grid on n, subtract the maximum (to scale it), and then only exponentiate (to avoid numerical problems). See Appendix B.
b. In the same problem implement Metropolis–Hastings posterior simulation. Add the simulated posterior draws on top of the plot from (a).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
