Control variates: Difference between revisions

m
→‎Example: clean up inconsistent variable names
(Rescuing 1 sources and tagging 0 as dead. #IABot (v1.5beta))
m (→‎Example: clean up inconsistent variable names)
:<math>I = \int_0^1 \frac{1}{1+x} \, \mathrm{d}x</math>
using [[Monte Carlo integration]]. This integral is the expected value of <math>f(U)</math>, where
:<math>f(xU) = \frac{1}{1+xU}</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>
 
Now we introduce <math>g(xU) = 1+xU</math> as a control variate with a known expected value <math>\mathbb{E}\left[g\left(U\right)\right]=\int_0^1 (1+x) \, \mathrm{d}x=\tfrac{3}{2} </math> and combine the two into a new estimate
:<math>I \approx \frac{1}{n} \sum_i f(u_i)+c\left(\frac{1}{n}\sum_i g(u_i) -3/2\right). </math>