URI:
   DIR Return Create A Forum - Home
       ---------------------------------------------------------
       QA_Board
  HTML https://qaboard.createaforum.com
       ---------------------------------------------------------
       *****************************************************
   DIR Return to: Questions for R / RStudio (Spring 2023)
       *****************************************************
       #Post#: 65--------------------------------------------------
       Question for the MC. approximation through Change of Varibale me
       thod
       By: Cat Date: March 16, 2023, 6:28 pm
       ---------------------------------------------------------
       Can someone share the class code of "Change of Varbile" in the
       example of phi(z) we did in the lecture? I got my result from
       code kind of inappropriate from the theretical value.
       For now I get code like this:
       g_2 <- function(x,z){
       return(z*exp(-((z*y)^2)/2))
       }
       y <- runif(M)
       theta.2 <- mean(g_2(y,z))
       Phi.2 <- 0.5 + theta.2/sqrt(2*pi)
       Also could you also explain how this g_2 function come from?
       Thank you ;)  ;)  ;)
       #Post#: 66--------------------------------------------------
       Re: Question for the MC. approximation through Change of Varibal
       e method
       By: Taeho Kim Date: March 25, 2023, 2:42 pm
       ---------------------------------------------------------
       Hi Cat,
       Sorry for this late response.
       I am not sure why I didn't receive a notice for your posting.
       It was just mismatching the argument and the variable in the
       body:
       [code]
       g_2 <- function(x,z){
       return(z*exp(-((z*y)^2)/2))
       }
       [/code]
       That is, we need to replace the argument x by y.
       The function g_2() comes from the form of the change of variable
       approach on Page 30
  HTML https://drive.google.com/file/d/1egkNxJHQivAeLTwvxAbFisoUq055eYjP/view.
       I will not miss new postings again!
       *****************************************************