HW 21 Stat 705 Fall 2017 Assigned Wednesday 12/6/17 DUE Thursday 12/14/15 11:59pm, worth 16 points Consider the matrix > Bmat [,1] [,2] [,3] [,4] [1,] 1.2 2.9 -0.3 -0.4 [2,] 1.4 -0.7 0.7 2.8 [3,] -0.6 -0.7 -0.5 0.3 [4,] 2.3 1.1 1.9 1.5 [5,] -0.6 0.2 -0.5 2.4 [6,] 0.8 2.0 -1.0 -0.3 [7,] -1.0 1.0 0.0 0.0 [8,] 0.0 0.0 1.0 -1.0 [9,] 1.0 -1.0 0.0 0.0 (i) Code a function employing the Metropolis-Hastings Algorithm to sample a random 4-vector uniformly from the convex set D = {x = (x[1],x[2],x[3],x[4]) : c(Bmat %*% x)[j] + 1 >= 0 for all j=1,...,9 } [NOTE that D is non-empty because it contains the 0-vector in its interior, and you can check in various ways that this is a bounded set.] Test your function after doing a timing run to generate a sample of N=1e5 random 4-vectors uniformly distributed in this set. (ii) Do the same task you did in part (i) using a pure Accept-Reject algorithm. Do a timing run on the function you code in this part too, to see how long it takes to generate 1e5 uniformly distributed points in D. (iii) What are the densities of the four random coordinates of the uniformly distributed points in D ? Represent their densities as R functions, if possible, but in any case give accurate graphs of these 4 densities. (iv) Use your simulated 1e5 random points X in the 4-dimensional set D to estimate the probability P(X[1] > 0 and X[2] > 0 | X[3] > 0 and X[4] > 0) and provide some assessment of the accuracy of your estimated probability, (an upper bound on) its variance if possible and also a confidence interval if possible.