Change the experiment while preserving its mean
For \(I=\int_0^1 f(x)\,dx\), choose a probability density \(p(x)>0\) wherever \(f\ne0\). If \(X\) is drawn from \(p\), then averaging \(W=f(X)/p(X)\) gives
With independent draws and finite second moment, the estimator variance is \([\int f^2/p-I^2]/N\). Merely changing the point distribution without changing the weight would compute a different integral.
For nonnegative \(f\), Cauchy–Schwarz gives
Equality holds if \(p\) is proportional to \(f\). The ideal distribution would give identical weights, although constructing its exact normaliser frequently requires already knowing the answer. It remains a guide to choosing an approximate density.
Background · Monte Carlo standard error
Independent samples with finite variance give this ideal error scale. Importance weights and correlations can substantially alter the variance of the actual estimator.
A finite expectation with an infinite error bar
For \(f(x)=x^{-1/2}\) the integral is 2. Uniform sampling produces weights \(X^{-1/2}\) whose second moment is
The estimate has the right expected value, but its usual finite-variance standard error has no foundation.
Take \(p_a(x)=(a+1)x^a\) with \(a>-1\). An inverse-CDF draw is \(X=U^{1/(a+1)}\) for a uniform \(U\). For \(f=x^b\), the second moment is \(1/[(a+1)(2b-a+1)]\) when \(2b-a>-1\). At \(b=a=-1/2\), \(X=U^2\) and every weight equals exactly two. At \(b=-1/2,a=-1/4\), the second moment is
The variance is 1.3333 and 100 independent draws have standard deviation about 0.1155.
Compare sampling plans on the same draws
Use the same fixed pseudo-random uniform sequence for the two plans so changes reflect the transformation. Sweep the proposal exponent through the finite-variance boundary and inspect the running mean. One finite trajectory can look benign even when the theoretical second moment diverges.
Tutorial on signs and diagnostics
If \(f\) changes sign, can sampling proportional to \(|f|\) remove every fluctuation?
Worked solution
Then the weight is a constant magnitude multiplied by the sign of \(f\). Its variance vanishes only if that sign is constant almost everywhere. Cancellation between positive and negative contributions can still make relative accuracy poor.
A proposal has zero density on a short interval where \(f\) is nonzero. Does increasing the number of samples repair the estimate?
Worked solution
No sample can reach that interval, so the corresponding integral contribution is absent. This is a bias from missing support; the derivation of \(E[W]=I\) fails there.
Study the full derivation
Spend random samples where they reduce uncertainty · Function approximation and numerical integration
A Monte Carlo estimate can be unbiased and still too noisy to be useful. Derive control variates, allocate a fixed budget across strata, and distinguish variance reduction from an underestimated standard error.