Question

4x3dx. 6. Consider estimating θ (a) Construct standard simulation estimator (b) Construct importance sampling estimator (choo
0 0
Add a comment Improve this question Transcribed image text
Answer #1

a) A standard simulation estimator of the integral is implemented in R below:
set.seed(1567)
f <- function(x){
4*x^3
}
std_mc <- function(f, B){
x <- runif(B)
ff <- f(x)
return(ff)
}
B <- 100000
I <- std_mc(f,B)
mean(I)
var(I)

b) An importance sampling estimator based exponential distribution (weight function)  f(x)=\lambda e^{-\lambda x};x>0 is given below.

set.seed(1567)
f <- function(x){
4*x^3
}

imp_mc <- function(lambda, f, B){
x <- rexp(B, lambda)
ff <- pexp(1,lambda)*f(x[x<1.0]) / dexp(x[x<1.0], lambda)
return(ff)
}
lambda <- 0.045
B <- 100000
I <- imp_mc(lambda, f, B)
mean(I)
var(I)

c) The variance in first case is 1.273779 and variance in second case (importance sampling) is 1,259844 thus achieving variance reduction.

Add a comment
Know the answer?
Add Answer to:
4x3dx. 6. Consider estimating θ (a) Construct standard simulation estimator (b) Construct importance sampling estimator (choose appropriate pro- posal density) (c) Compare the variances of the ab...
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