[Math] E(|X|) for normally distributed X

absolute valueintegrationnormal distributionprobabilityprobability distributions

I need to find the expectation for |X|, E(|X|) for a normally distributed variable with parameters, $\mu$, $\sigma^2$. I've setup the integral that I think is necessary, but I'm having trouble evaluating it. Here's what I have so far:

$E(|X|) = \frac{1}{\sigma \sqrt{2\pi}} (-\int_{-\infty}^\infty |x|e^{\frac{-(x-\mu)^2}{2\sigma^2}} dx)$
$E(|X|) = \frac{1}{\sigma \sqrt{2\pi}} (-\int_{-\infty}^0 xe^{\frac{-(x-\mu)^2}{2\sigma^2}} dx + \int_{0}^\infty (x-\mu)e^{\frac{-(x-\mu)^2}{2\sigma^2}} dx + \int_{0}^\infty \mu e^{\frac{-(x-\mu)^2}{2\sigma^2}} dx)$

Any help on how to evaluate this would be appreciated, thanks in advance.

Best Answer

It is preferable to standardize $X$ and consider the expectation of the transformed variable. Specifically, we note $$X = \sigma Z + \mu, \quad Z \sim \operatorname{Normal}(0,1).$$ Thus $$\operatorname{E}[|X|] = \operatorname{E}[|\sigma Z + \mu|] = \sigma \operatorname{E}[|Z + \mu/\sigma|].$$ What this shows is that we should consider the cases $$Z < -\mu/\sigma, \quad Z \ge -\mu/\sigma,$$ and for convenience, let us define $m = -\mu/\sigma$. Then $$\begin{align*} \operatorname{E}[|X|] &= \frac{\sigma}{\sqrt{2\pi}} \left( \int_{z=-\infty}^m -(z+m) e^{-z^2/2} \, dz + \int_{z=m}^\infty (z+m) e^{-z^2/2} \, dz \right) \\ &= \frac{\sigma}{\sqrt{2\pi}} \left( 2e^{-m^2/2} + m \int_{z=m}^\infty e^{-z^2/2} \, dz - m \int_{z=-\infty}^m e^{-z^2/2} \, dz \right) \\ &= \sigma e^{-m^2/2}\sqrt{\frac{2}{\pi}} + \mu \int_{z=m}^\infty f_Z(z) \, dz - \mu \int_{z=-\infty}^m f_Z(z) \, dz \\ &= \sigma e^{-\mu^2/(2\sigma^2)}\sqrt{\frac{2}{\pi}} + \mu (1 - 2 \Phi(-\mu/\sigma)). \end{align*}$$

Related Question