Question

Obtain a Monte Carlo estimate of

dr =e V27

by importance sampling using R.

Hint: Use the pdf of Pareto(1,1) for the importance function.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

The Pareto distribution is f(x)=\frac{1}{x^2};x>1 . This is the importance function.

Let g(x)=\frac{x^2}{\sqrt{2\pi }}e^{-x^2/2} . We need to evaluate \int_{1}^{\infty }g(x)dx . Using the above importance sampling function,

\int_{1}^{\infty }g(x)dx=\int_{1}^{\infty }g(x)\frac{f(x)}{f(x)}dx\\ \int_{1}^{\infty }g(x)dx=\int_{1}^{\infty }\frac{g(x)}{f(x)}f(x)dx\\ \int_{1}^{\infty }g(x)dx=E_f\left ( \frac{g(X)}{f(X)} \right )

The R code for finding the value of \int_{1}^{\infty }\frac{x^2}{\sqrt{2\pi }}e^{-x^2/2}dx is given below.

library(VGAM)
set.seed(1567)
g <- function(x){
x^2*exp(-x^2/2)/sqrt(2*pi)
}
imp_mc <- function(f, B){
x <- rpareto(B, scale=1,shape=1)
gg <- g(x) / dpareto(x, scale=1,shape=1)
return(gg)
}
B <- 100000
I <- imp_mc(g, B)
mean(I)

The simulated value is {\color{Blue} \int_{1}^{\infty }\frac{x^2}{\sqrt{2\pi }}e^{-x^2/2}dx=0.4018581} . The exact value is 0.400626.

Add a comment
Know the answer?
Add Answer to:
Obtain a Monte Carlo estimate of by importance sampling using R. Hint: Use the pdf of...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT