HW 19 Stat 705 Fall 2015 Assigned Wednesday 12/9/15 DUE Thursday 12/17/15, worth 15 points (1) A pair of random variables (X,Y) is assumed to have joint density such that given Y , X ~ Expon(lambda) with rate lambda = 1+2*Y given X , Y ~ Beta(1+2X, 3+X^2) Write an R function to simulate random pairs (X_i,Y_i) from this joint density (not necessarily independent across i), and use that function to find (either through a picture, a density function, or some other representation) the density function of X. (2) Generate a small dataset according to the commands set.seed(7793) xv = runif(80) yv = 1.5*xv + 0.8*rnorm(80) Use these data to simulate the posterior density of b given (xv,yv) in the model: yv[i] = b* xv[i] + sig*eps[i] with eps i.i.d. N(0,1), i=1,..,80 where (b, tau) = (b, 1/sig^2) are viewed as unknown statistical parameters with prior density b ~ N(0, 10^2), tau ~ Gamma(0.5,.05). To solve this problem you must implement the Gibbs Sampler directly in R , and hand in your code for it, rather than use any pre-programmed package. -------------- For both parts of this HW set: show whatever checks you can to establish that your R code does what it is supposed to, i.e. that the simulated (Gibbs-Sampled) sequences have the desired properties.