Question: USE R Suppose we have a random variable X with probability density function (pdf) f(x) = 1 /2 x + 3 /4 , 0 x
USE R
Suppose we have a random variable X with probability density function (pdf) f(x) = 1 /2 x + 3 /4 , 0 x 1 and the cumulative distribution function will be F(x) = 1 /4 x^2 + 3 /4 x, 0 x 1
(a) (10 points) Use inverse transform method to generate X. Write a function to input the sample size n and output a sample of X following above distribution.
(b) (5 points) Set a random seed 329, use your function to generate 5000 observations, and compute the mean and variance.
(c) (5 points) Make a histogram of the generated data, plot the curve of the pdf with color blue
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
