I have the following integral (x^-0.5) ;in x=[0.01,1] To solve this using Importance Sampling MC integration, one needs to select an importance pdf that is approximately the same as the function plot
My R code to solve the same is this : #function 1 - importance sampling w <- function(x) dunif(x,0.01,1)/dbeta(x,0.7,1) f <- function(x) x^(-0.5) X <- rbeta(1000,0.7,1) Y <- w(X)*f(X) c(mean(Y),var(Y)) True integral value - 1.8 Using the Importance Sampling code above - 1.82 (where my importance PDF is Beta(0.7,1) which is quite alright so I'm assuming the code is correct. --------------------------------------------- However I now have two bivariate functions that look like this in intervals [x,y] in [-pi,pi] and [x,y] in [-5,5] respectively - [image: bivariate function 1] Could anyone guide on how to perform MC Importance Sampling for these functions? I know I could select two independent distributions however, I have no idea about how to choose the functions or coding it like the way above. -- Regards and Cheers, Pooja Voladoddi +91-90351 93110 -- View this message in context: http://r.789695.n4.nabble.com/R-Importance-Sampling-Monte-Carlo-method-for-bivariate-integration-tp4686375.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.