Exchange differentiation with integration: $E[f'(X)/f(X)X]$

53 Views Asked by At

Let $X$ be a random variable with p.d.f. $f(x)$ (absolutely continuous and differentiable everywhere) and let $s(x)$ be the density score, i.e., $s(x) = d\log f(x)/ d x = f'(x)/f(x)$. Assume $\int |x| f(x)dx < \infty$, why is the following calculation nonsense? $$ \begin{align} E[s(X)X] &= \int \frac{f'(x)}{f(x) }x f(x) dx = \int f'(x) x dx \\ &= \int \frac{d}{dx} f(x) x dx = \frac{d}{dx} \int f(x)xdx \\ &= \frac{d}{dx} E[X] = 0. \end{align} $$ This must be wrong, because I know if $X$ is a standard normal random variable, then $f'(x) = -x f(x)$, thus $E[s(X)X] = E[-X^2] = -E[X^2] = -1 \neq 0$. I know that the problem is the exchange of differentiation with integration, but what is wrong with the standard normal random variable such that the exchange is not permitted?

I appreciate any help!

1

There are 1 best solutions below

1
On BEST ANSWER

Here is a correct computation, assuming $f$ is continuously differentiable, strictly positive, and $|x|f(x) \to 0$ as $x \to \pm \infty$:

\begin{align*} \mathbf{E}[s(X)X] &= \int_{\mathbb{R}} \frac{f'(x)}{f(x)} x f(x) \, \mathrm{d}x = \int_{\mathbb{R}} x f'(x) \, \mathrm{d}x \\ &= \left[ xf(x) \right]_{-\infty}^{\infty} - \int_{-\infty}^{\infty} f(x) \, \mathrm{d}x \\ &= -1, \end{align*}

where we utilized integration by part in the second line. As per your mistake, in general

$$ \int \frac{\mathrm{d}u(x)}{\mathrm{d}x} v(x) \, \mathrm{d}x \quad\neq\quad \frac{\mathrm{d}}{\mathrm{d}x} \int u(x) v(x) \, \mathrm{d}x. $$

This is evident if you differentiate both side:

$$ \frac{\mathrm{d}}{\mathrm{d}x} \text{[LHS]} = u'(x) v(x), \qquad \text{whereas}\qquad \frac{\mathrm{d}}{\mathrm{d}x} \text{[RHS]} = u'(x) v(x) + u(x) v'(x). $$