Monte Carlo integration using importance sampling given a proposal function
Given a Laplace Distribution proposal: g(x) = 1/2*e^(-|x|) and sample size n = 1000 , I want to Conduct the Monte Carlo (MC) integration for estimating θ: via importance sampling. Eventually I want to calculate the mean and standard deviation of this MC estimate in R once I get there. Edit (arrived late after the answer below) This is what I have for my R code so far: library(VGAM) n = 1000 x = rexp(n,0.5) hx = mean(2*exp(-sqrt(x))*(sin(x))^2) gx = rlaplace(n, location = 0, scale = 1) Now we can write a simple R function to sample from Laplace distribution: ## `n` is sample size rlaplace <-