# Standard Normal Dist Transformation

mrkb80

## Homework Statement

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}$

## Homework 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.

## 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:

Homework Helper
Gold Member
$f(y)=1/\sqrt{2\pi}e^{-|y|^2/2}$
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.

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:
Homework Helper
Gold Member
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?
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?

Homework Helper
Gold Member
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?
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.

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.

Homework Helper
Gold Member
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.
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

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?

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:
Homework Helper
Dearly Missed

## Homework Statement

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}$

## Homework 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.

## 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.

$$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

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.