In example 6.14 of the textbook (MS) the exponential density with beta =2 is supplied:
f(y)=(e^(-(y)/(2)))/(2),y>=0
Also the cumulative distribution function was calculated:
F(y)=1-e^(-(y)/(2))
If we desire a random sample from f(y) we could use the w-F theorem (6.7).
w=F(y) where W∼Unif(0,1) and therefore y=F^(-1)(w).
Instead, create an objective function:
w-F(y)=0, supply a random w and find the roots of g(y)=0 where g(y)=w-F(y). In this case, we will use the optimize() function and find the
minimum of |g(y)| when w=0.5. Submit to 4 decimal places
In example 6.14 of the textbook(MS)the exponential density with beta=2 is supplied
f(y) =e /2 2,y0 Also the cumulative distribution function was calculated: F(y) = 1 - ey/2 If we desire a random sample from f(y) we could use the w-F theorem (6.7).
w = F(y) where W ~ Unif(0,1) and therefore y = F-1(w).
Instead,create an objective function:
w - F(y) = 0, supply a random w and find the roots of g(y) = 0 where g(y) = w-F(y). In this case, we will use the optimize( function and find the minimum of |g(y)| when w =0.5.Submit to 4 decimal places