Use R code to answer question. There is 2 parts to the question, the first being straight forward and the second using a monte carlo method.
Question:
Let U and V both follow Uniform(0,1) distributions. Find two methods to simulate the
distribution of U+V. The first method should directly simulate the distribution using
uniforms, and the second should use a Monte Carlo method.
Hint:
--First: call two random uniforms and add. Second:
--Generate uniform between 0 and 2 (x), then
another between 0 and ½ (y). Sum of two uniforms is a
line straight up to ½ (occurring at x=1)
then down to 0 (occurring at x=2). Accept randomly generate point if either is true: For x < .5, y < x/2. For x > .5, y < .5 – x/2. Otherwise, reject point.
I think the first part is just something like x = runif(1) + runif(1). I have no idea how to complete the 2nd part using monte carlo.
Get Answers For Free
Most questions answered within 1 hours.