# Monte Carlo Integration for non-square integrable functions

I hope this is the right place to ask, if not feel free to move it to a more appropriate forum.

I've been wondering for quite a while now how to treat non-square integrable functions with Monte Carlo Integration. I know that MC still gives a proper estimate but the error is unrealiable (divergent?) for those kind of functions.

Let's restrict us to one dimension. Monte Carlo integration means that we approximate the integral

$$I = \int_0^1 \mathrm{d}x \, f(x)$$

using the estimate

$$E = \frac{1}{N} \sum_{i=1}^N f(x_i)$$

with $x_i \in [0,1]$ uniformly distributed random points. The law of large numbers makes sure that $E \approx I$. The sample variance

$$S^2 = \frac{1}{N-1} \sum_{i=1}^N (f (x_i) - E)^2$$

approximates the variance $\sigma^2$ of the distribution induced by $f$. However, if $f$ is not square-integrable, i.e. the integral of the squared function diverges, this implies

$$\sigma^2 = \int_0^1 \mathrm{d} x \, \left( f(x) - I \right)^2 = \int_0^1 \mathrm{d} x \, f^2(x) - I^2 \longrightarrow \infty$$

meaning that also the variance diverges.

A simple example is the function

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

for which $I = \int_0^1 \mathrm{d}x \, \frac{1}{\sqrt{x}} = 2$ and $\sigma^2 = \int_0^1 \mathrm{d}x \, \left( \frac{1}{x} - 2 \right) = \left[ \ln x - 2x \right]_0^1 \rightarrow \infty$.

If $\sigma^2$ is finite one can approximate the error of the mean $E$ by $\frac{S}{\sqrt{N}} \approx \frac{\sigma}{\sqrt{N}}$, but what if $f(x)$ is not square-integrable?

• I don't get it: you start out by noting that none of the $E_i$ has a variance and then ask whether the variance of their average would be a reasonable estimator of--that nonexistent variance! Or do I misread this question: perhaps by "statistically independent estimations" you have some different (perhaps robust) estimator of the integral in mind?
– whuber
Commented Jun 21, 2013 at 18:14
• I didn't say $E$ doesn't have a variance, only that I cannot define a variance for it by $S^2$. So the question is whether I can define an error at all and if $\bar{S}^2$ is a reasonable candidate. By statistically independent I mean that the $E_i$ are obtained using different random numbers, e.g. by using differently seeded random number generators (I hope thats the right term then). Commented Jun 22, 2013 at 6:38
• Please explain what you mean by not being able to "define a variance for it by $S^2$." I cannot make sense of this using the standard definitions of variance and $S^2$.
– whuber
Commented Jun 24, 2013 at 14:45
• Well, the function is not square-integrable so, if I am not mistaken, $S^2$ should diverge. If this is the case the definition for $S^2$ makes no sense in the first place, right? By means of the central limit theorem, however, $E$ will still converge to the true value of the integral, but without an error this value alone makes no sense (how 'good' is this result?). Commented Jun 26, 2013 at 13:55
• Sorry, I meant to say "law of large numbers" of course, not CLT. Commented Jun 26, 2013 at 14:04