HW 20 Stat 705 Assigned Monday 12/5/16 Due Tuesday 8pm 12/20/2016 ================================================================== NOTE: UNLIKE PREVIOUS HW'S THE DEADLINE FOR THIS ONE IS NOT EXTENDABLE, SINCE GRADES FOR THE COURSE NEED TO BE SUBMITTED BY 12/23. ALSO: YOU MUST SUBMIT THIS ONE ELECTRONICALLY, EVEN IF YOU SUMBIT EARLIER. I WILL NOT BE ON CAMPUS FOR THE BEGINNING OF THAT WEEK TO COLLECT PAPERS. The topic of this HW is an important Gibbs Sampler Example: (1) A pair of random variables (U,V) is assumed to have joint density such that given U , V ~ Gamma(A, B1+B2*(U-b)^2) given V , U ~ N(D*V/(V+C), 1/(V+C)) where A, B1,B2,b,C,D are constants. Write an R function to simulate random pairs (U_i,V_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) of the density function of U. (2) Show that the conditional density structure given in (1) holds conditionally given the data (X_1,..., X_n) in a normal N(mu, 1/tau) sample, for the two variables V = n*tau , U = mu where the prior densities of independent tau and mu are respectively assumed to be tau ~ Gamma(nu/2, 1/2) and mu ~ N(0, 1/eps) and find the constants A,B1,B2,b,C,D as functions of n, nu, eps, and X_1,...,X_n (or Xbar and S^2). Note that 1/eps and 1/tau denote normal variances in this example. (3) Use your Gibbs Sampler found in part (1), in the setting of part (2), to find the posterior expectations of mu and 1/tau given the data example of 50 frontal-lobe sizes (in millimiters), assumed iid N(mu,1/tau), of the 50 female blue crabs in the dataset "crabs" located in the MASS library in R, where eps = 0.05 and nu = 3.