# Standard Normal Dist Transformation

1. Sep 20, 2012

### mrkb80

1. The problem statement, all variables and given/known data
The question ask to find $E[X]; E[X^2]; Var(X)$ for the standard normal distribution $f(x)=1/\sqrt{2\pi}e^{-x^2/2}$

2. Relevant equations
I found
\begin{align} E[X]&=\int_{-\infty}^\infty \! x*1/\sqrt{2\pi}e^{-x^2/2} \, \mathrm{d} x\\ &=1/\sqrt{2\pi} ( \int_{-\infty}^0 \! x*e^{-x^2/2} \, \mathrm{d} x + \int_{0}^{\infty} \! x*e^{-x^2/2} \, \mathrm{d} x )\\ &= 1/\sqrt{2\pi} ( (-1-0) + (0+1) )\\ &= 0 \end{align}
I found $E[X^2]=1$
and $Var[X]=1$. So far no problem.

3. The attempt at a solution
Now, I am asked to find the pdf, $E[Y], Var[Y]$ of $Y=|X|$
Since the inverse of $Y=|X|$ is $X=|Y|$ and the derivative of the inverse is 1. The transformation seems fairly straight forward.

$f(y)=1/\sqrt{2\pi}e^{-|y|^2/2}$

I am just not sure about the domain of y, isn't it exactly the same as X because x is squared? Once I get that I should be able to use the same integration technique as above to find $E[Y]; Var[Y]$ Wouldn't these values be exactly the same as $E[X]; Var[X]$? Something seems wrong here.

Last edited: Sep 20, 2012
2. Sep 20, 2012

### jbunniii

No, this can't be right. Y = |X|, so Y can never be negative. Therefore f(y) must be zero for negative y. Your f(y) does not have that property.

 Just saw your remark about the domain. Right, so as I said, f(y) must be zero for negative y. However, you can't simply write
$$f(y) = \left\{ \begin{array}{lr} 1/\sqrt{2\pi}e^{-|y|^2/2} & y \geq 0 \\ 0 & \text{otherwise} \end{array} \right.$$
because that function will not integrate to 1. But I'm sure you can fix that easily enough.

3. Sep 20, 2012

### mrkb80

I guess then the inverse of $Y=|X|$ is not $X=|Y|$. It must be something like
$f(y) =1/\sqrt{2\pi}e^{-y^2/2} \, for \, y\geq0$.Which I think means I'm only looking at half the distribution. The right half to be exact. Correct?

Last edited: Sep 20, 2012
4. Sep 20, 2012

### jbunniii

Y = |X| doesn't have a (single-valued) inverse. For every nonzero value of Y, there are two values of X that give Y = |X|. You have to account for both of these. Hopefully you have seen an example of how to do this in your textbook or lecture?

5. Sep 20, 2012

### jbunniii

Yes, this is almost correct. However, because you chopped off the left half, it no longer integrates to 1. You have to re-scale it appropriately.

6. Sep 20, 2012

### mrkb80

So I must have to multiply it by 2.
$f(y) =2/\sqrt{2\pi}e^{-y^2/2} \, for \, y\geq0$ ?

I don't really see how an absolute value transformation works for a distribution that isn't the standard normal.

I'm confused.

7. Sep 20, 2012

### jbunniii

Yes, in general it's a bit more complicated. Here it was easier because the standard normal is symmetric around zero. To see how it works in a somewhat more general case, consider what happens if you start with a normal distribution that has nonzero mean. There's an expression for the PDF here:

http://en.wikipedia.org/wiki/Folded_normal_distribution

Note that it simplifies to your result if $\mu = 0$.

If your book doesn't cover how to calculate the density function when the transformation is not one-to-one, you can read about it here (and I would also recommend finding a better book!)

http://www.cl.cam.ac.uk/teaching/2003/Probability/prob11.pdf

8. Sep 20, 2012

### mrkb80

I do not like the main book, but I looked in the second book and I just realized how you would have to do it. You would need to break it up into parts that are monotone and add them together. Correct?

9. Sep 20, 2012

### mrkb80

So if my integration is correct
\begin{align} E[Y]&=\int_0^\infty \! 2/\sqrt{2\pi}e^{-y^2/2} \, dy \\ &=2/\sqrt{2\pi} (-e^{-y^2/2}|_0^ \infty)\\ &=2/\sqrt{2\pi} \end{align}

and
$Var(Y)=1-2/\pi$

Edit: I saw where you posted the link to the folded normal. These answers are correct. Thanks for your help!

Last edited: Sep 20, 2012
10. Sep 21, 2012

### Ray Vickson

$$E|X| = \int_{-\infty}^{\infty} |x| f(x) \, dx = 2 \int_0^{\infty} x f(x) \, dx.$$ This is not zero.

$$\text{Var}(|X|) = E(|X|^2) - (E|X|)^2 = E(X^2) -(E|X|)^2 = 1 - (E|X|)^2,$$ because EX2 is just the variance of X.

RGV

11. Sep 21, 2012

### mrkb80

The absolute value threw me because the inverse is not monotone. The book does a horrible job of explaining how to handle this case and instead focuses on the fact that it must be strictly increasing or decreasing in the domain for the transformation to work.

I guess another way to think about this problem would be to split the absolute value into two parts.
$\int_0^\infty \! yf(y) dy \, + \int_0^\infty \! yf(y) dy$
since Y=|X| if I put postive values into x, I get postive y's and if I put negative values into x I get the same postive y's (hence the 2 times or the sum of integrals). Since x is defined for $-\infty \le x \le \infty$ I must transform the entire domain, but you can see that when I do this I get only postive y's, so the domain of y must be $y \geq 0$.

Thanks everyone for the help.