91
Questions for R / RStudio (Spring 2023) / Question for the MC. approximation through Change of Varibale method
« Last post by Cat on March 16, 2023, 07:28:02 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
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
Recent Posts