You are on page 1of 1

School of Mathematics, Statistics and Applied Mathematics National University of Ireland, Galway

1314-ST417: Homework 3
Due date: Thu 21 Nov 2013

Problem 1 (20 points) Let X Gamma(a, b), where fX (x) = ba /(a)x(a1) exp(bx) is the density of the Gamma distribution. (a) Prove that Y = 1/X is distributed as IGamma(a, b), where the density of the IGamma distribution is given by fY (y ) = ba /(a)y (a1) exp(b/y ). (b) Plot the density curves of Gamma(a, b), for (a, b) = {(1, 1), (2, 1), (2, 3)} (on the same graph) and similaryly, of IGamma(a, b) for the same set of (a, b) values. Problem 2 (30 points) Consider the following hierarchical Bayesian model: iid Y1 , Y2 , ..., Yn |, 2 N(, 2 ) 2 N(0 , 0 ) 2 IGamma(a, b) (a) Write down the expression for the joint distribution f (y, , 2 ). (b) Find the full conditionals f (| 2 , y ) and f ( 2 |, y ). To derive the full conditional for , for example, select all the terms from f (, 2 , y ) that contain and ignore all the multiplicative constants. From the expression so obtained infer the explicit complete formula for the conditional density. Problem 3 (50 points) For the model specied in the previous problem write the code in R implementing a Gibbs sampler to obtain posterior draws of and 2 . Use N(0, 1) as a prior for and IGamma(2, 1) as a prior for 2 . As a data set, use 20 random samples from N( = 1, 2 = 42 ) and starting points (0) = 0 and 2 = 1. Let the number of simulations be M = 10, 000. Using the last 1, 000 iterations produce the following plots: (a) ACF, (b) PACF, (c) time series graphs of posterior samples, (d) histograms of posterior samples overlayed with the graphs of the corresponding prior densities, (e) a scatter plot of (|y ) vs. ( 2 |y ).

You might also like