I have hopefully a short/simple question regarding monte carlo estimators. The expected value of a function of a random variable can be defined as:

$$E[f(x)] = \int_{-\infty}^{\infty} f(x) p(x) dx$$

where $p(x)$ is a probability density function.

The Monte Carlo estimator is defined as:

$$\langle I\rangle = {1 \over N } \sum_{i=1}^N {f(x_i) \over p(x_i) }$$

My understanding was that the MC estimator could be used to estimate the expected value of the function of a random variable. In other words, we can use it to estimate $E[f(x)]$. So evaluating $f(x)$ for random variables $x$ and taking the average seems like an intuitive way of explaining why the MC estimator would work, but I don't understand why $f(x)$ is divided by the probability density function while in the first equation $f(x)$ is multiplied by it!?

I understand the first equation. It's quite similar to the way we compute the expected value of a discrete random variable ($E(x)=\sum x_i p_i$) so I understand the first equation but don't understand really how to go from the first equation to the MC estimator.

It would be great if someone could explain!

Thank you.

  • $\begingroup$ Are you doing some importance sampling? $\endgroup$ – copper.hat Nov 26 '13 at 23:16

It appears like you are trying to do something like this (see slide 15). In that case, what the monte carlo estimator $\langle I \rangle$ is doing does not make sense if you think of it as calculating the $E[f(x)]$. What that estimator is doing is calculating $\int_{-\infty}^{\infty} f(x) dx$ using a Monte Carlo method that samples the $x_i$ not uniformly but according to the density function $p(x_i)$, where $p(x_i)$ is chosen to sample the places where $f(x_i)$ is large more often than where it is small, thereby making better use of limited computer resources - this is called importance sampling (as copper.hat pointed out). To calculate the expected value of $f(x_i)$ you first need to specify the distribution of the $x_i$ and then generate Monte Carlo values of $f(x_i)$ with x's drawn from that distribution.

To summarize, the Monte Carlo estimator for the average of a random function and for the integral of a deterministic function are completely different things. You can't necessarily mix them. I think your confusion is thinking $\langle I \rangle$ is for $E[f(x_i)]$, which is it not. Your intuition on how to calculate $E[f(x_i)]$ is correct.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.