# How to Transform a Folded Normal Distribution into a Gamma Distribution?

Let the random variable $X$ have the folded Normal pdf

$$f(x)=\frac{2}{\sqrt{2\pi}}e^{\frac{-x^2}{2}}$$

with $0\lt x \lt \infty$.

What is the transformation $g(X)=Y$ and values of $\alpha$ and $\beta$ so that $Y \sim \Gamma(\alpha,\beta)$?

I am trying to do some extra problems in my book and just having a bit of a difficult time even getting started, so any hints would be helpful.

• Hint: what does the PDF of a Gamma distribution look like? It, too, involves an exponential, but how does its argument compare to the $-x^2/2$ in the folded Normal? That ought to suggest a transformation--and it will work. – whuber Feb 4 '15 at 22:48
• So since $\Gamma(1/2)=\sqrt{\pi}$, would it be something along the lines of $\alpha = \frac{1}{2}$ and $\beta = \frac{2}{x}$? Can Beta be dependent on x? – James Snyder Feb 5 '15 at 1:18
• And if that was the case, would the transformation just be dividing it by 2 since that is the only missing term when those values are put into the original Gamma pdf? – James Snyder Feb 5 '15 at 1:22
• Rather than looking at the constant, look at the term in the exponent for the gamma and the folded normal, as whuber was hinting. What would you do to make one look like the other? Please add the self-study tag and look at its tag wiki – Glen_b -Reinstate Monica Feb 5 '15 at 2:44
• Hint: if $Z \sim N(0,1)$, then $Z^2 \sim \chi^2(1)$ which is also a Gamma random variable whose parameters you might know already, or for which you can search for in your textbook or Wikipedia etc. – Dilip Sarwate Feb 5 '15 at 15:09

1. Focus on the form of the function by ignoring additive and multiplicative constants.

2. Always, always, include the differential element.

For example, a generic Normal PDF is of the form

$$f(x;\mu, \sigma) = \frac{1}{\sqrt{2\pi \sigma^2}}\exp\left(-\frac{1}{2} \left(\frac{x-\mu}{\sigma}\right)^2\right)$$

Following (1), strip this down to $\exp(-x^2)$ and following (2), multiply by $dx$, giving

$$f(x) = \exp(-x^2)dx.$$

Consider now the generic Gamma PDF

$$g(y; \alpha, \beta) = \frac{1}{\beta\,\Gamma(\alpha)} \left(\frac{y}{\beta}\right)^{\alpha-1}\exp(-y/\beta).$$

Following the same two rules to focus on the essential part of the PDF produces

$$g(y) = y^{\alpha-1}\exp(-y)dy.$$

Notice that the constant $\alpha-1$ stayed because it is neither added to nor multiplies the variable $y$ itself: it is a power. We are going to have to figure out what the possible values of $\alpha$ could be.

Compare $f$ to $g$ and ask,

What should $y = y(x)$ be in order to make the two PDFs look more alike?

The only thing that is obviously common to the two forms is the exponential. Ignoring everything else, compare the two exponential parts of $f$ and $g$:

$$\exp(-x^2)\text{ versus }\exp(-y).$$

To convert one into the other, our only choice is

$$y = x^2.$$

Here is where (2) comes in: when you substitute $x^2$ for $y$ in $g$, make sure to include the differential element. Let's do that step first:

$$dy = d(x^2) = 2 x dx.$$

The last step differentiates $x^2$ (which is all that "$d$" asks us to do). Therefore

$$g(y)\vert_{y \to x^2} = (x^2)^{\alpha-1} \exp(-x^2) (2 x dx) = 2 x^{2\alpha-1}\exp(-x^2) dx.$$

Once again, drop any multiplicative or additive constants and compare:

$$x^{2\alpha-1}\exp(-x^2) dx = g(y) \text{ versus } f(x) = \exp(-x^2)dx.$$

We have accomplished what we intended: $\exp(-x^2)$ is common to both expressions. Although they still look different insofar as the left hand side still has an extra factor of $x^{2\alpha-1}$, they actually will be the same provided

$$x^{2\alpha-1} = \text{ constant }.$$

This uniquely determines $\alpha=1/2$. Although all these calculations were performed to transform a Normal distribution to a Gamma distribution, in review you can see that they work for the folded Normal, which has exactly the same form as the Normal PDF. Now you know which Gamma distribution to use. The rest is a matter of working out the value of $\beta$, which I leave to the interested reader.

While the method described by whuber is a very general one, in this case, there is a much easier method for getting the answer: indeed a method that might be describable as more from a statistician's perspective than a probabalist's perspective.

Following up on my hint on the main question, consider a standard normal random variable $Z$ whose square $Z^2$ has a $\chi^2(1)$ distribution which is also a Gamma distribution with (shape and scale) parameters $\left(\frac 12, 2\right)$. Now, the given folded normal random variable $X$ has the same distribution as $|Z|$, and thus $Y = X^2$ has the same distribution as $|Z|^2 = Z^2 \sim \chi^2(1)$. Thus, the function $g(x)$ that is sought is just $g(x) = x^2$ and the resulting Gamma density has shape and scale parameters $\left(\frac 12, 2\right)$. More generally, $cX^2$ has a Gamma density with shape and scale parameters $\left(\frac 12, 2c\right)$.