Question: (d)Write a function called rsin2 which generates random values from the density f(x)/k, 0 c: x (d)Write a function called rsin2 which generates random values


(d)Write a function called rsin2 which generates random values from the density f(x)/k, 0 c: x
(d)Write a function called rsin2 which generates random values from the density f (x)/k, O < x < 2m , where k is the area found above. The function should take a single argument specifying how many samples are required, e.g. would return a vector of 10 samples from this distribution. Use the rejection method to draw the samples. Plot a histogram based on 1000 samples. (e)Use your function to draw a sample of 1,000,000 samples, and calculate a 95% confidence interval for the mean. (By symmetry, the true mean must be It. Did your confidence interval cover the true value?)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
