Compute the density of $Y=|X|$ when $X$ is normally distributed

889 Views Asked by At

When $X$ has the normal distribution $\mathcal N(\mu,\sigma^2)$ , compute the density of $Y=|X|$

I know $\displaystyle\int_{-\infty}^{\infty}\frac{1}{\sigma\sqrt{2\pi}}\exp\Big(-\frac{-(x-\mu)^2}{2\sigma^2}\Big)dx=1$

but the choice of $\mu$ doesn't change the result (integral is always 1), So if we take $\mu=0$ then the function gets even and since $Y$ supports only the positive part we have to multiply the distribution by 2, but can we then translate it back and this is our function ?

$2^{nd}$ Question: what is the difference between distribution and density, in this case they seem to be the same or not ?

2

There are 2 best solutions below

7
On BEST ANSWER

If $X \sim \mathcal{N}(\mu,\sigma^2)$, then $P(X \leq u) = P(X \in (-\infty,u]) = P(X \in (-\infty,u)) = \Phi_{\mu,\sigma^2}(u)$, where $$ \Phi_{\mu,\sigma^2}(u) = \frac{1}{\sigma\sqrt{2\pi}}\int_{-\infty}^u e^{-\frac{(x-\mu)^2}{2\sigma^2}} \,dx $$ is the cumulative distribution function (CDF) of $\mathcal{N}(\mu,\sigma^2)$. Note that the density of $\mathcal{N}(\mu,\sigma^2)$ is $$ \phi_{\mu,\sigma^2}(x) = \frac{d}{dx} \Phi_{\mu,\sigma^2}(x) = \frac{1}{\sigma\sqrt{2\pi}} e^{-\frac{(x-\mu)^2}{2\sigma^2}} $$

Now let $Y = |X|$ and $u \geq 0$. The CDF of $|Y|$ is $$\begin{eqnarray} P(Y \leq u) &=& P(|X| \leq u) = P(X \in [-u,u]) = P(X \in (-\infty,u]\setminus (-\infty,-u)) \\ &=& P(X \in (-\infty,u]) - P(X \in (-\infty,-u)) = \Phi_{\mu,\sigma^2}(u) - \Phi_{\mu,\sigma^2}(-u) \text{.} \end{eqnarray}$$

To find the density of $|Y|$, we differentiate again $$ \frac{d}{du} P(Y \leq x) = \frac{d}{dx} \Phi_{\mu,\sigma^2}(x) - \frac{d}{du} \Phi_{\mu,\sigma^2}(-x) = \phi_{\mu,\sigma^2}(x) + \phi_{\mu,\sigma^2}(-x) \text{.} $$ Thus, the density of $|Y|$ on $\mathbb{R}$ is $$ f_Y(x) = \begin{cases} \frac{1}{\sigma\sqrt{2\pi}}\left(e^{-\frac{(x-\mu)^2}{2\sigma^2}} + e^{-\frac{(x+\mu)^2}{2\sigma^2}}\right) &\text{if $u \geq 0$} \\ 0 &\text{otherwise.} \end{cases} $$


Note that this works regardless of the specific distribution of $X$ - except in the last line where we defined the resulting density $f_Y$, we never used any specific properties of $\Phi_{\mu,\sigma^2}$ or $\phi_{\mu,\sigma^2}$, except that they are a CDF respectively its density. Thus, it holds for any random variable with CDF $F_X$ and density $f_X$ that $|X|$ has the density $$ f_{|X|}(x) = \begin{cases} f_X(x) + f_X(-x) &\text{if $x \geq 0$} \\ 0 &\text{otherwise.} \end{cases} $$ and the cumulative distribution function $$ F_{|X|}(u) = F_{X}(u) - F_{X}(-u) \text{.} $$ Beware though that the formula for the CDF is wrong if $X$ doesn't have a density (for example for a discrete distribution), even though the density is never mentioned directly. This is because in the derivation of $F_{|X|}$ we assumed at one point that $P(X \leq u) = P(X < u)$.

16
On

If $X$ has density $f$ then $Y=|X|$ has density $g$ where $$ g(y)=(f(y)+f(-y))\,\mathbf 1_{y\gt0}. $$ In the present case, $$ g(y)=\frac{\mathrm e^{-(y^2+\mu^2)/\sigma^2}\,(\mathrm e^{y\mu/\sigma^2}+\mathrm e^{-y\mu/\sigma^2})}{\sigma\sqrt{2\pi}}\,\mathbf 1_{y\gt0}. $$