Question: Problem 2 ( a ) [ 2 points ] Consider the random variable Y with density g ( y ) = s i n (
Problem a points
Consider the random variable with density with support in the interval Explain
how you can use inverse transformation method to generate values from this random variable. Describe the
method specifically with the functions given in this problem. You won't get any points for describing the
method in general terms. No R code needed here.
Problem b points
Write an R code to generate values from the random variable using the inverse transformation method
that you described in part a Use seed Draw a histogram of the values you obtain, superimposed by a
smoothed density, using the following code is a vector of generated values in the following code:
hist freq FALSE, breaks
curve pi type l add TRUE, col"red"
Show your code. Hint: On one of the boundaries of the distribution, the generated values might not look
quite right due to rounding error. Ignore issue due to rounding errors.
Problem c points
Write an code to implement the acceptreject algorithm that uses the random values of that you generated
in part b to generate random values from the random variable with the density with
support in To obtain an envelope obtain the optimal value of such that Show how
you find Also show how many of the values that you generated are accepted. Note: There is no
need to use loops. Implement your code in vectorized form. Show your R code. Use the following code to
show your generated values superimposed by the density
hist freq FALSE, breaks
curvexpi pi type add TRUE, col"red"
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
