URI:
   DIR Return Create A Forum - Home
       ---------------------------------------------------------
       QA_Board
  HTML https://qaboard.createaforum.com
       ---------------------------------------------------------
       *****************************************************
   DIR Return to: Questions for R / RStudio (Fall 2023)
       *****************************************************
       #Post#: 131--------------------------------------------------
       HW7 Problem #4.
       By: Beryl Date: October 23, 2023, 8:19 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?
       #Post#: 132--------------------------------------------------
       Re: HW7 Problem #4.
       By: Taeho Kim Date: October 23, 2023, 8:45 pm
       ---------------------------------------------------------
       Hi Beryl,
       Yes, you are correct.
       It's a mistake, and we should remove arctan() when taking the
       inverse.
       Thank you for posting the correction.
       I've corrected the HW question and will grade the submitted
       homework accordingly.
       *****************************************************