[Math] Double integral estimation with Monte Carlo method by importance

integrationmonte carlo

I have this integral

$\int_{0}^{\infty}\int_{0}^{\infty} e^{-x-y-xy}dxdy$

I have to estimate the value of it using the Monte Carlo method, using as importance function the exponential PDF.

Does anyone have any ideas how I can do this? How can I apply a change of variables to go from 0 $\rightarrow$ $\infty$ to 0 $\rightarrow$ 1 (so I can also implement a small program to simulate the solution)?

Thank you.

Best Answer

Found the solution.

So, I implemented both the "brute" method, and the method based on importance (or importance sampling).

  1. The brute method just takes "n" random numbers (pairs of (x,y) numbers, to be exact), and calculates an average of all the function values that we get in those points. (In this case we have to divide by $n^2$ since we have two random variables)

Something like this: $\bar\theta = \frac{1}{n} \frac{1}{n} \sum_{i=1}^{n} e^{-X_i -Y_i -X_i Y_i} $ where $X_i$ and $Y_i$ are the random numbers. In my case, $n=100,000,000$ to get near the actual integral value.

  1. For the method based on the importance function, I used the exponential function: $p(x, y) = e^{-x -y}$ as the importance function. Using it, we have the following integral to calculate: $I = \int_{0}^{\infty} \int_{0}^{\infty} \frac{e^{-x-y-xy}}{e^{-x-y}} dx dy$ which results into $I = \int_{0}^{\infty} \int_{0}^{\infty} e^{-xy} dx dy$

So, using the MC method:

$\bar\theta = \frac{1}{n} \sum_{i=1}^{n} e^{-X_i Y_i}$.

The $X_i$ and $Y_i$ random variables are generated using the inverse method. I used the inverse of the exponential function, which is the logarithm function.

So in my program I generated numbers between 0 and 1, and passed them to the logarithm function, which gave me back numbers between 0 and $\infty$ (actually more like between 0 and 100, since $\infty$ is hard to reach on most computers).

Related Question