Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 2 ( a ) [ 2 points ] Consider the random variable Y with density g ( y ) = s i n (

Problem 2(a)[2 points]
Consider the random variable Y with density g(y)=sin(y), with support in the interval 0,2. 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 2(b)[3 points]
Write an R code to generate 10,000 values from the random variable Y using the inverse transformation method
that you described in part (a). Use seed 2024. Draw a histogram of the values you obtain, superimposed by a
smoothed density, using the following R code [Y is a vector of generated values in the following code]:
hist , freq = FALSE, breaks =50
curve(sin(x),0, pi/2, type ="l", add = TRUE, col="red")
Show your R 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 2(c)[5 points]
Write an R code to implement the accept-reject algorithm that uses the random values of Y that you generated
in part (b), to generate random values from the random variable x with the density f(x)=8x2 with
support in 0,2. To obtain an envelope obtain the optimal value of such that gy?f(x).. Show how
you find . Also show how many of the 10,000 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 f(x).
hist , freq = FALSE, breaks =50
curve(8*x/pi"2,0, pi/2, type ="1", add = TRUE, col="red")
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Creating A Database In Filemaker Pro Visual QuickProject Guide

Authors: Steven A. Schwartz

1st Edition

0321321219, 978-0321321213

More Books

Students also viewed these Databases questions