Integration by Importance sampling

252 Views Asked by At

I want to estimate the integral $\int_0^1\frac{1}{\sqrt x}dx$ by importance sampling method.

So, here $f(x)=1\frac{1}{\sqrt x}$

We have to introduce another probability distribution $g(x)$, then $\int_0^1\frac{1}{\sqrt x}dx = \int_0^1\frac{\frac{1}{\sqrt x}}{g(x)}g(x)dx= E_g[\frac{\frac{1}{\sqrt X}}{g(X)}] \approx \frac{1}{N}\sum_{i=1}^{N}\frac{\frac{1}{\sqrt X_i}}{g(X_i)}$

But I cannot decide what will be the function $g(x)$ so that the integration gives accurate result. Will it be a $N(0,1)$ pdf or some pdf taking values within the interval $(0,1)$ or some pdf taking positive values only?

Thanks in advance.

1

There are 1 best solutions below

0
On BEST ANSWER

The problem:

Estimate

$$\int_a^b p(x)dx=\int_0^1 \frac{1}{\sqrt{x}}dx=2$$

This is a very easy integral that we can exactly calculate finding 2 as a result.

In order to use Importance sampling Method we have to choose a good function that approximate our $p(x)$

A nice function is $f(x)\propto e^{-x}$

so normalize it as to transform $f$ in a nice density....

easy...

$$f_X(x)=\frac{e}{e-1}e^{-x}\cdot \mathbb{1}_{(0;1)}(x)$$

Let's calculate its CDF....easy again (calculations omitted)

$$F_X(x)=y=\frac{e}{e-1}[1-e^{-x}]$$

Let's now invert F so that we can use the Integral Transform Theorem

We are all set!

the values of Y come from a standard uniform distribution, say $Y\sim U(0;1)$ so with any calculator you can sample from this distribution (I used Excel for the sampling) and you have only to calculate the sample mean of the ratio $\frac{p(x)}{f(x)}$

This is the beginning of my table

enter image description here

...the resulting mean of these few data is $\approx 1.64$ but with $n=2500$ I got a result of $1.990636$

...pretty good