Approximating integration by samples of a probability distribution

40 Views Asked by At

Let $f(x)$ be a probability density function (PDF) and $x_i\sim f(x), i=1,\ldots, n$ be $n$ i.i.d samples of $f(x)$. Then we may write:

$$E(X) = \int x f(x) dx\approx\frac{1}{n}\sum_{i=1}^n x_i$$

In the above equation we are approximating an integration using samples of a PDF.

Is it also possible to approximate the following integral using samples of $f(x)$ (i.e. $x_1,\ldots,x_n$)? $$\int x f'(x) dx\approx \ ?$$ where $f'(x)=\frac{d}{dx}f(x)$.

Edit:

As pointed by Kavi Rama Murthy the above integral equals $-1$ if the integration is over the entire domain of $f(x)$. What happens if we restrict the integration domain? $$\int_a^b x f(x) dx\approx \frac{1}{n}\sum_{i=1}^n x_i \times \mathbb{I}(a\leq x_i \leq b)$$ where $\mathbb{I}$ is the indicator function. $$\int_a^b x f'(x)dx =x f(x)|_a^b - \int_a^b f(x) dx\approx \ ?$$

1

There are 1 best solutions below

1
On

For sufficiently nice density functions $f$ we have $\int x f'(x)dx=-1$: Integrate by parts to get $xf(x)|_{-\infty}^{\infty} -\int f(x)dx=0-1=-1$.