## Importance sampling and example

December 27, 2013 Leave a comment

**1. Importance sampling idea**

We have random variable , it has pdf (probability density function) p(x),

we have known

And according Monte Carlo estimator, if we want evaluate function f(x) by samples from p(x), we got

where is sample from

**Let’s say we want( or can only) to sample from another distribution function q(x), but we still want to get the value by Monte Carlo method, what we should do?**

For clear, we use another random variable , its pdf q(x)

A little trick

it just looks like we want evaluate function by samples from q(x), using the new random variable , we have

According Monte Carlo like above, we should have

so we have

where is sample from

**this is what importantce sampling does, it uses samples from another distribution funtion, but still evaluate the old function for old random variable**.

**2. why Importance sampling can do better**

let’s caculate variance on

so it we select q(x) smartly, we can get a much smaller