Partial Solution to HW Set 7 ---------------------------- These partial solutions show how to get the bounding functions for Accept-Reject. >>>>>>>>>>>>>>>>>>> (a) A random vector (X_i,Y_i) with joint density f(x,y) on the positive quadrant equal to K xy/(1+x^2+y^2)^5 for x,y>0 and equal to 0 for other x,y. Here K is a constant > 0 for you to determine. ## Part (a): in polar coordinates, find theta is uniform in (0, pi/2) ## and independent of r , which has density r^3/(1+r^2)^5 > optimize(function(x) x^3/(1+x^2)^5,c(0,10), maximum=T) $maximum [1] 0.6546413 $objective [1] 0.0471547 > curve(x^3/(1+x^2)^5,0,3) > curve(x^3*exp(-4.2*x^2),0,.62,add=T, col="red") > optimize(function(x) (1+x^2)^(-5)*exp(4.2*x^2),c(0,.62),maximum=T) $maximum [1] 6.631725e-05 $objective [1] 1 > C1 = 1/integrate(function(x) (1+abs(x))*exp(-x^2/2),-1,1)$val > C1 [1] 0.4002902 > C1*(2-2*exp(-.5)+sqrt(2*pi)*(2*pnorm(1)-1)) [1] 1 ##--------------------- (b) A random variable X_i with density f(x) = C*(1+abs(x))*exp(-x^2) for -1 < x < 1 and equal to 0 elsewhere, where C is a constant for you to determine. ### Part (b) > curve((1+abs(x))*exp(-x^2/2),0,1) > optimize(function(x) (1+x)*exp(-x^2/2),c(0,1), maximum=T) $maximum [1] 0.618034 $objective [1] 1.336733 > curve((1+x)*exp(-x^2/2),0,1) > .33674/.61803^2 [1] 0.8816081 > curve(1.337-.881*(x-.61803)^2,0,1,add=T,col="red") > optimize(function(x) (1+x)*exp(-x^2/2)/ (1.34-.881*(x-.61803)^2),c(0,1),maximum=T) $maximum [1] 0.618126 $objective [1] 0.9975622