16.1 The Monte Carlo method
To estimate \(\theta = \mathbb E[g(X)]\), draw independent copies \(X_1, \ldots , X_n\) and form \(\hat \theta _n = \frac 1n\sum g(X_i)\). By the law of large numbers \(\hat \theta _n \to \theta \), and by the central limit theorem \(\hat \theta _n\) is approximately normal with standard deviation \(\sigma /\sqrt n\), where \(\sigma ^2 = \operatorname {Var}g(X)\) is estimated by the sample variance \(s^2\). So \[ \hat \theta _n \pm 1.96\,\frac s{\sqrt n} \] is an approximate \(95\%\) confidence interval. The error decreases like \(1/\sqrt n\), whatever the dimension of the problem: a hundred times more work buys one more correct digit. Integrals are expectations too: \(\int _0^1e^{-v^2}\,dv = \mathbb E[e^{-U^2}]\) for \(U\) uniform, estimated from \(100\,000\) uniforms as \(0.74684 \pm 0.00125\) against the exact \(0.74682\) (Software 16.5.1).
Questions on this section
Stuck on something here? Ask below and it stays attached to this topic.