11

Let $X$ follow a uniform distribution and $Y$ follow a normal distribution. What can be said about $\frac X Y$? Is there a distribution for it?

I found the ratio of two normals with mean zero is Cauchy.

Stephan Kolassa
  • 95,027
  • 13
  • 197
  • 357
rrpp
  • 131
  • 4
  • 3
    For what it's worth, the distribution of $Y/X$ is called the [slash distribution](https://en.wikipedia.org/wiki/Slash_distribution). I don't know if the reciprocal has a name or a closed form. – David J. Harris Mar 27 '14 at 04:31
  • 2
    And the larger class to which both belong seems to be [ratio distributions](https://en.wikipedia.org/wiki/Ratio_distribution#Uniform_ratio_distribution)! – Nick Stauner Mar 27 '14 at 04:33
  • 7
    @DavidJ.Harris Quite so; +1. I've seen the slash used a few times in robustness studies. Maybe $X/Y$ - as an inverted slash - should be called the "*backslash distribution*". – Glen_b Mar 27 '14 at 04:46
  • @Glen_b Aha - I like that!! – wolfies Mar 27 '14 at 04:57
  • 1
    @rrpp Are you referring to a standard $Uniform(0,1)$, or a general $Uniform(a,b)$? If the latter, then we need to know if $a>0$, $a<0$ etc. – wolfies Mar 27 '14 at 05:15
  • 1
    thank you all for your answers. @wolfies $X$ is $ Uniform(0,1)$ and $Y$ has positive mean – rrpp Mar 27 '14 at 05:38
  • 1
    @wolfies It suffices to treat the case $X \sim U(0,1)$. Indeed, if $U_0 \sim U(a,b)$ and $Y_0 \sim N(\mu, \sigma^2)$, then $U_0 /Y_0$ is equal in distribution to $U_1/Y_1$ where $U_1 \sim U(0, 1)$ and $Y_1 \sim N(a + (b-a)\mu, (b-a)^2 \sigma^2)$. – QuantIbex Mar 27 '14 at 06:06
  • For those interested in the special case where $a$ and $b$ are equal and of opposite signs, the result is presented at https://stats.stackexchange.com/questions/359685. Of course it is readily derived from any of the answers here, but some cancellation of terms occurs, making the expression particularly simple. – whuber Jul 30 '18 at 16:23

3 Answers3

13

Let random variable $X \sim \text{Uniform}(a,b)$ with pdf $f(x)$:

enter image description here

where I have assumed $0<a<b$ (this nests the standard $\text{Uniform}(0,1)$ case). [ Different results will be obtained if say parameter $a<0$, but the procedure is exactly the same. ]

Further, let $Y \sim N(\mu, \sigma^2)$, and let $W=1/Y$ with pdf $g(w)$:

enter image description here

Then, we seek the pdf of the product $V = X*W$, say $h(v)$, which is given by:

enter image description here

where I am using mathStatica's TransformProduct function to automate the nitty-gritties, and where Erf denotes the Error function: http://reference.wolfram.com/language/ref/Erf.html

All done.

Plots

Here are two plots of the pdf:

  • Plot 1: $\mu = 0$, $\sigma = 1$, $b = 3$ ... and ... $a = 0, 1, 2$

enter image description here

  • Plot 2: $\mu = {0,\frac12,1}$, $\sigma = 1$, $a=0$, $b = 1$

enter image description here

Monte Carlo check

Here is a quick Monte Carlo check of the Plot 2 case, just to make sure no errors have crept in:
$\mu = \frac12$, $\sigma = 1$, $a=0$, $b = 1$

enter image description here

The blue line is the empirical Monte Carlo pdf, and the red dashed line is the theoretical pdf $h(v)$ above. Looks fine :)

wolfies
  • 6,963
  • 1
  • 22
  • 27
3

It is possible to find the distribution of $Z=\frac{X}{Y}$ from first principles, where $X\sim U[0,1]$ and $Y \sim N(\mu,\sigma^2)$. Consider the cumulative probability function of $Z$:

$$F_Z(z) = P(Z\le z) = P\left(\frac{X}{Y} \le z \right)$$

Consider the two cases $Y>0$ and $Y<0$. If $Y>0$, then $\frac{X}{Y}\le z\implies X \le zY $. Similarly if $Y<0$ then $\frac{X}{Y}\le z\implies X \ge zY $.

Now we know $-\infty<Z<\infty$. To find the above probability, consider the cases $z>0$ and $z<0$.

If $z>0$, then the probability can be expressed as an integration of the joint distribution of $(X,Y)$ over the below shown region. (using the inequalities)

Integration Region

So $$F_Z(z) = \int_0^1 \int_{x/z}^\infty f_Y(y) dy dx + \int_0^1 \int_{-\infty}^0 f_Y(y) dy dx $$ where $f_Y(y)$ is the distribution function of $Y$.

Find the distribution function of $Z$ by differentiating the above. $$\begin{align*} f_Z(z) &= \frac{d}{dz}\int_0^1 \left[ F_Y(\infty) - F_Y\left(\frac{x}{z}\right) \right] dx \\ &= \int_0^1 \frac{\partial}{\partial z} \left[ F_Y(\infty) - F_Y\left(\frac{x}{z}\right) \right] dx \\ &= \int_0^1 \frac{x}{z^2} f_Y\left(\frac{x}{z}\right) dx \\ &= \int_0^1 \frac{x}{\sqrt{2\pi}\sigma z^2} \exp \left( - \frac{\left( \frac{x}{z}-\mu\right)^2}{2\sigma^2} \right) dx \end{align*}$$

The integral above can be evaluated using the following sequence of transformations:

  1. Let $u=\frac{x}{z}$
  2. Let $v=u-\mu$
  3. Separate the resulting integral into two integrals, one with $v$ only in the exponential, and one with $v$ multiplying with the exponential.

The resulting integrals can be simplified to yield $$f_Z(z) = \frac{\sigma}{\sqrt{2\pi}}\left[ \exp\left(\frac{-\mu^2}{2\sigma^2}\right)-\exp\left(\frac{-\left(\frac{1}{z}-\mu\right)^2}{2\sigma^2}\right) \right] + \mu \left[ \Phi\left(\frac{\frac{1}{z}-\mu}{\sigma}\right)-\Phi\left(\frac{-\mu}{\sigma}\right) \right]$$

Here $\Phi(x)$ is the cumulative distribution function of the standard normal. An identical result is obtained for the case $z<0$.

This answer can be verified by simulation. The following script in R performs this task.

n <- 1e7
mu <- 2
sigma <- 4

X <- runif(n)
Y <- rnorm(n, mean=mu, sd=sigma)

Z <- X/Y
# Constrain range of Z to allow better visualization 
Z <- Z[Z>-10]
Z <- Z[Z<10] 

# The actual density 
hist(Z, breaks=1000, xlim=c(-10,10), prob=TRUE)

# The theoretical density
r <- seq(from=-10, to=10, by=0.01)
p <- sigma/sqrt(2*pi)*( exp( -mu^2/(2*sigma^2)) - exp(-(1/r-mu)^2/(2*sigma^2)) ) + mu*( pnorm((1/r-mu)/sigma) - pnorm(-mu/sigma) )

lines(r,p, col="red")

Here are a few graphs for verification:

  1. For $Y\sim N(0,1)$ Check 1
  2. For $Y\sim N(1,1)$ Check 2
  3. For $y\sim N(1,2)$ Check 3

The undershooting of the theoretical answer seen in the graphs around $z=0$ is probably because of the constrained range. Otherwise the theoretical answer seems to follow the simulated density.

Comp_Warrior
  • 2,075
  • 1
  • 20
  • 35
  • 1
    +1 Very nice! A derivation from basic principles is always satisfying and the graphics help the reader to apprehend instantly what you are doing. – whuber Aug 26 '14 at 17:13
2

Besides the reciprocal of the slash distribution (or @Glen_b's "backslash distribution!"), a kind of ratio distribution, I don't know what to call it either, but I'll simulate one version in R.
Since you specify a positive mean of $Y$, I'll use $Y=\mathcal N(7,1)$ so that $\min(Y)>1$ in most samples of $N\le1\rm M$. Of course, other possibilities exist. For instance, any $Y<1$ would expand the range of $\frac X Y$ beyond 1, and any $Y<0$ would of course expand it into negative values. set.seed(1);x=rbeta(10000000,1,1)/rnorm(10000000,7);hist(x,n=length(x)/50000)
(Decrease size for slow computers! Or use runif if you know how!)

enter image description here

Nick Stauner
  • 11,558
  • 5
  • 47
  • 105
  • 2
    the extreme tails are mucking up the density. The distribution is rather like a Cauchy. (Out of curiosity, why not use `runif`? It seems more idiomatic and seems also to be faster) – Glen_b Mar 27 '14 at 05:19
  • Because I still don't know that much about R, apparently! :) Thanks for the tip! – Nick Stauner Mar 27 '14 at 06:17
  • 1
    no worries. The difference in speed is not so large, but with 10^7 elements, enough to notice. You may find a histogram worth looking at (`hist(x,n=length(x),xlim=c(-10,10))`) (about 96% of the distribution seems to be inside those limits) – Glen_b Mar 27 '14 at 06:22
  • 1
    Wow! Sure enough. Makes these density plots quite misleading I'm afraid! I'll edit in that histogram... – Nick Stauner Mar 27 '14 at 07:17
  • Oh, sorry, I hadn't noticed yours was N(7,1) before now; that makes my limits less than useful, and my nclass way too large (my own was N(0,1)). Still, it's enough to see the shape. – Glen_b Mar 27 '14 at 08:51
  • It wasn't originally; I started with the standard normal distribution, then switched to $\mathcal N(7,1)$ because I was already editing, saw the OP's comment, and thought I'd get simpler results if I prevented $Y$ from going $<1$ in my example. I think @wolfies has the more general answer covered better than I could anyway. – Nick Stauner Mar 27 '14 at 08:54
  • 1
    Oh, okay. No worries. You may want to make nclass a good deal smaller in that case. I think ideally the bars should be very narrow but not just black lines. – Glen_b Mar 27 '14 at 09:17
  • Much better! Makes it all run quite a bit faster too of course. Thanks again! – Nick Stauner Mar 27 '14 at 09:31