# Distribution of ratio $X/Y$ where $X$ is normal, $Y$ is half normal

I know the ratio of 2 normally distributed random variables is a cauchy distribution...which, of course, has no variance.

But, if I have $X$ and $Y=|X|$ and take this ratio:

$Z=X/Y$, is it possible to find the variance of the ratio of the normal distribution to the half normal?

Edit: (More details)

I am missing something a little in the answers so far, but I am extremly grateful. Let me provide a little more background.

Measuring data from sensors includes the process value and some noise. Xk = Vk + Nk, where Vk is the process measurement and Nk is the noise.

There are two issues, (1) Estimating Vk and (2) detecting a shift or change point.

I can estimate Vk using an exponential filter.

so F0k = a*(Xk) + (1-a)*F0k-1. The expected value of F0 -> E(F0) = E(X). This means exponential filtering will give me my expected value. The variance of F0 -> var(F0) = (a/(2-a))*var(X)

At this point I am interested in residuals: RES = Xk - F0k. This quantity should be 0 in the steady state. That is to say, the expected value is 0. I also assume that the value will be normally distributed (don't yell at me about this assumption). I can estimate the expected value online using a simple exponential filter (basically the same as an average):

F1k = b*(RES) + (1-b)*F1k-1.

The expected value of F1 -> E(F1) = E(RES) = 0. The variance of F1 -> var(F1) = (2/(2-a))(b/(2-b))*var(X)

Then I can take abs(RES) and use exponential filtering again:

F2k = b*(abs(RES)) + (1-b)*F2k-1

The expected value of F2 -> E(F2) = E(abs(RES)) = [sqrt(2/(2-a))*sqrt(2)/(sqrt(pi))]std(X). The variance of F2 -> var(F2) = (2/(2-a))(b/(2-b))*(1-(2/pi))*var(X)

All of these expected values and variances are just from either the exponential filtering properies or the expected value and variance of the normal or half-normal distribution.

My question was, what is the variance (and expected value) of Z = F1/F2

F1 will be some normally distributed value with expected value = 0. F2 will be some half-normally distributed value with expected value based on the standard deviation of x.

Can you find the var of Z?

I understand that X/abs(X) would just give you a bernoulli, but it seems it doesn't give me exactly what i'm looking for?

Edit: (More details)

Here are some interesting simulation results:

F1 - exponential filter of Residual (noise added to original signal was Gaussian - result is normally distributed)

F2 - exponential filter of abs(Residual) (half-normal distribution)

Z - F1/F2 - simulated distribution of ratio of F1/F2 (notice the large variance around expected value of 0)

-
In this case $Z = X/Y = X/|X| = {\rm sign}(X)$, so its variance exists and can be calculated. Also, if this happens to be homework, please add the homework tag –  Macro May 11 '12 at 2:10
This is not homework. Thank you. I would just like to calculate the variace. This ratio is extremely useful in detecting mean shifts in data online. If xi = INi - AVGi. A change in the mean will change the expected value of Z from 0 to 1. The question of when the mean shift occurs must be triggered based on the variance of Z. –  nick May 11 '12 at 2:17
Just to correct and add it is the ratio of two independent standard normals that is Cauchy and the Cauchy not only has no variance but even the mean does not exist. –  Michael Chernick May 11 '12 at 2:49
I suspect a typo or some other missing information in this question. Macro has provided a very complete answer to the question as currently posed, but the subsequent comment by the OP seems to reveal that something is amiss; @Macro's analysis would not seem to have any application to the problem described in the comments. –  cardinal May 11 '12 at 11:36
@cardinal: perhaps Nick meant folded-normal? –  Macro May 11 '12 at 14:11

In general, the variance of $X/Y$, where $X$ is normal and $Y$ is half-normal, does not exist. Informally, this is because $Y$ has too much mass near 0. However, the situation you described is a special case, since $Y = |X|$.

In your description $X \sim N(\mu, \sigma^2)$ and $Y = |X|$. Therefore

$$Z = \frac{X}{|X|} = {\rm sign}(X) = \begin{cases} 1 &\mbox{if } X > 0 \\ -1 & \mbox{if } X < 0. \end{cases}$$

So, $Z = 1$ with probability $p = P(X>0) = \Phi \left( \frac{\mu}{\sigma} \right)$, where $\Phi$ denotes the Normal CDF, which fully characterizes the distribution of $Z$, which is the question posed by the title.

To answer the question posed in the body of your post about the variance of $Z$, note $Z$ can be written as $2B - 1$ where $B \sim {\rm Bernoulli}(p)$ (see here for info on the Bernoulli distribution). Therefore,

$$E(Z) = E(2B-1) = 2p-1$$

$${\rm var}(Z) = {\rm var}(2B-1) = 4{\rm var}(B) = 4p(1-p)$$

-
(+1) It should be $\Phi\left(-\dfrac{\mu}{\sigma}\right)$ in the expression for $p$. I tried to edit this little typo but I could not because it is less than 6 characters. –  user10525 May 11 '12 at 12:09
Sorry for bothering you again, I am affraid now the typo comes from me, it should be $+\frac{\mu}{\sigma}$. –  user10525 May 11 '12 at 13:55
You're right - thanks for catching that! –  Macro May 11 '12 at 13:56
Macro, this makes a lot of sense, I didn't think about it like that. In this case, what I have (and I wasn't clear about) is: Z = E(X)/E(abs(X)). E(X) has a variance that is related to the exponential filter properties. E(abs(X)) has a variance related to the exponential filter and the absolute value. I am still getting confused on what the actual variance is. You can see from my simulations that the steady-state distribution of Z is very small above 0.8. Therefore, 0.8 would be a great threshold for non-steady state (transient) detection. But how....how was I supposed to know that? –  nick May 11 '12 at 23:49

Let $X,Y$~$N(0,1)$ and let $U=\frac{X}{Y}$ and $V=Y$

Here $f_{X,Y}(x,y)=\frac{1}{2\pi}e^{-\frac{1}{2}(x^2+y^2)},(x,y)\in\mathbb{R}^2$

Here $u=\frac{x}{y}$ and $v=y$

$=>~x=uv$ and $y=u$

Clearly $u=\frac{x}{y}$ and $v=y$ is a one-to-one transformation from $\mathbb{R}^2$ onto $\mathbb{R}^2$

Jacobian is $J=\begin{vmatrix} v & u \\ 0 & 1 \end{vmatrix}$

Now find the PDF of $(U,V)$ and find PDF of $U$ by integrating the PDF of $(U,V)$ over the range of $U$.

You get $U=\frac{X}{Y}$~$C(0,1)$.[Cauchy distribution]

Let $W=\frac{X}{|Y|}$

The distribution function of $W$ is $$F_W(w)=P[W\leq w]=P[W\leq w|Y>0].P[Y>0]+P[W\leq w|Y<0].P[Y<0]$$$=\frac{1}{2}{(P[U\leq w]+P[-U\leq w])}$$=\frac{1}{2}2(P[U\leq w]=F_U(w)$

[Since $U$ is symmetrically distributed about $0$]

-