5,337
edits
Line 28: | Line 28: | ||
Suppose we want to estimate <math>I_1 = \int_{a}^{b}f(x)dx</math>.<br> | Suppose we want to estimate <math>I_1 = \int_{a}^{b}f(x)dx</math>.<br> | ||
Then we can use <math>\hat{I_1} = \frac{b-a}{N}\sum f(X_i)</math> where <math>X_1,...,X_n \sim Uniform(a,b)</math>.<br> | Then we can use <math>\hat{I_1} = \frac{b-a}{N}\sum f(X_i)</math> where <math>X_1,...,X_n \sim Uniform(a,b)</math>.<br> | ||
This is because <math>E[\frac{b-a}{N}\sum f(X_i)] = \frac{b-a}{N}\sum E[f(X_i)] = \frac{1}{N}\sum \int_{a}^{b}(b-a)f(x)(1/(b-a))dx = \int_{a}^{b}f(x)dx</math><br> | This is because <math>E\left[\frac{b-a}{N}\sum f(X_i)\right] = \frac{b-a}{N}\sum E[f(X_i)] = \frac{1}{N}\sum \int_{a}^{b}(b-a)f(x)(1/(b-a))dx = \int_{a}^{b}f(x)dx</math><br> | ||
Note that in general, if we can sample from some distribution with pdf <math>p(x)</math> then we use the estimator: | |||
* <math>E\left[ \frac{1}{N} \sum \frac{f(X_i)}{p(X_i)} \right]</math> | |||
===Importance Sampling=== | |||
Suppose we can only sample from pdf <math>g(x)</math> but we want to sample from pdf <math>p(x)</math> to yield a more reliable (less variance) estimate.<br> | |||
Then we can sample from <math>p(x)</math> using <math>Y = F_{p}^{-1}(F_{g}(X))</math>.<br> | |||
Then apply the above equation. | |||
[[Visible to::users]] | [[Visible to::users]] |