Control variates: Difference between revisions

Added text to →‎Example
m (fixed formula formatting)
(Added text to →‎Example)
 
==Example==
 
We would like to estimate
:<math>I = \int_0^1 \frac{1}{1+x} \, \mathrm{d}x.</math>
 
The exact result is <math>I=\ln 2 \approx 0.69314718</math>. Using [[Monte Carlo integration]], this integral can be seen as the expected value of <math>f(U)</math>, where
 
:<math>f(x) = \frac{1}{1+x}</math>
and ''U'' follows a [[uniform distribution (continuous)|uniform distribution]]&nbsp;[0,&nbsp;1].
Using a sample of size '''n''' denote the points in the sample as <math>u_1, \cdots, u_n</math>. Then the estimate is given by
:<math>I \approx \frac{1}{n} \sum_i f(u_i)</math>;
 
If we introduce <math>T=\int_0^1 1+x \, \mathrm{d}x. </math> as a control variate with a known expected value <math>\textrm{E}\left[T\left(U\right)\right]=\frac{3}{2}</math>
 
Using <math>n=1500</math> realizations and an estimated optimal coefficient <math> c^{\star} \approx 0.4773 </math> we obtain the following results
 
{| cellspacing="1" border="1"
|
| align="right" | '''Estimate'''
| align="right" | '''Variance'''
|-
| ''Classical Estimate''
| align="right" | 0.69475
| align="right" | 0.01947
|-
| ''Control Variates ''
| align="right" | 0.69295
| align="right" | 0.00060
|}
 
The variance was significantly reduced after using the control variates technique.
 
==See also==