1
Questions for R / RStudio (Fall 2023) / HW7 Problem #4.
« on: October 23, 2023, 09:19:12 pm »
In Problem(4), I have a question when generating r.v. by using the inverse cdf approach.
I think I am supposed to generate r.v. from X which has a pdf of h(x)=1/(0.87*(1+x^2/2)) by inverse cdf approach to finish the Importance Sampling Apporach of M.C intergral.
But I calculated the Inverse CDF H^-1(x), which is sqrt(2)*tan(0.87*x/sqrt(2)) by calculation of intergral and is not equal to the Inverse cdf which the question provided. I then make a plot by tried both H^-1(x) and check the histogram of r.v. and compared with the h(x) and I found the r.v. generated under my calculated H^-1(x) has a histogram fits the curve of h(x).
Is there anything wrong?
I think I am supposed to generate r.v. from X which has a pdf of h(x)=1/(0.87*(1+x^2/2)) by inverse cdf approach to finish the Importance Sampling Apporach of M.C intergral.
But I calculated the Inverse CDF H^-1(x), which is sqrt(2)*tan(0.87*x/sqrt(2)) by calculation of intergral and is not equal to the Inverse cdf which the question provided. I then make a plot by tried both H^-1(x) and check the histogram of r.v. and compared with the h(x) and I found the r.v. generated under my calculated H^-1(x) has a histogram fits the curve of h(x).
Is there anything wrong?