# How to obtain the Standard Deviation of a ratio of independent binomial random variables?

X and Y are 2 independent binomial random variables with parameters (n,p) and (m,q) respectively. (trials, probability parameter)

-
Isn't there positive probability that this ratio is undefined? –  guy Aug 27 '11 at 4:30

If $n$ and $m$ go to infinity while $p$ and $q$ are fixed, then the ratio $R=X/Y$ is well defined on an event of probability $1-o(1)$.

On this event (or conditionally on this event, since the two asymptotically equivalent), Edgeworth expansions of $X$ and $Y$ show that the expectation of $R$ behaves like $\dfrac{np}{mq}$ and that its variance behaves like $$\left(\frac{np}{mq}\right)^2\left(\frac{1-p}{np}+\frac{1-q}{nq}\right).$$

-

There probably isn't a closed-form formula for this.

But $X$ has mean $np$ and standard deviation $\sqrt{np(1-p)}$, and $Y$ has mean $mq$ and standard deviation $mq(1-q)$.

Now you need a simple fact: if $X$ has mean $\mu$ and standard deviation $\sigma$, then $\log X$ has mean approximately $\log \mu$ and standard deviation approximately $\sigma/\mu$. This can be derived by Taylor expansion. Intuitively, $X$ "usually" falls in $[\mu-\sigma, \mu+\sigma]$ and so $\log X$ "usually" falls in $[\log (\mu-\sigma), \log (\mu+\sigma)]$. But we have

$$\log (\mu \pm \sigma) = \log (\mu(1 \pm \sigma/mu)) = \log \mu \pm \log(1 \pm \sigma/mu) \approx \log \mu \pm \sigma/mu$$

where the approximation is the first-order Taylor expansion of $\log (1+x)$.

Therefore $\log X$ has mean approximately $\log np$ and standard deviation approximately $\sqrt{(1-p)/np}$; similarly $\log Y$ has mean approximately $\log mq$ and standard deviation approximately $\sqrt{(1-q)/mq}$.

So $\log X - \log Y = \log X/Y$ has mean approximately $\log(np/mq)$ and standard deviation approximately $$\sqrt{{(1-p) \over np} + {(1-q) \over mq}}.$$

But you asked about $X/Y$. Inverting the earlier fact, if $Z$ has mean $\mu$ and standard deviation $\sigma$, then $e^Z$ has mean approximately $e^{\mu}$ and standard deviation approximately $\sigma e^\mu$. Therefore $X/Y$ has mean approximately $np/mq$ (not surprising!) and standard deviation approximately

$$\left( \sqrt{{(1-p) \over np} + {(1-q) \over mq}} \right) {np \over mq}.$$

-

In essence you are asking for the distribution of the variable Z = X/Y, where Z can take values in $\left\{ 0, \frac{1}{m}, \ldots, \frac{n}{1}, \infty \right\}$, where the fractions are of the form $\frac{k}{l}$ with $0 \leq k \leq n$, and $1 \leq l \leq m$, and I'm assuming the convention $\frac{k}{0} = \infty$, which as Guy pointed out means this will be undefined, and the standard deviation will be infinite. So instead condition that this cannot happen $$\mathbb{P}\left[Z = k/l | Y \neq 0 \right] = \frac{\mathbb{P}[Xl = YK \cap Y \neq 0]}{\mathbb{P}[Y \neq 0]}$$ So then this gives, \begin{align} \mathbb{P}\left[Z = k/l | Y \neq 0 \right] & = (1- (1-q)^m) \mathbb{P}[ Xl = Yk \cap Y \neq 0]\\ & = (1-(1-q)^m) \sum p^i(1-p)^{(n-i)}q^j(1-q)^{(m-j)} \end{align} where the sum is over all pairs $(i,j)$ with $0 \leq i \leq n$, $0 < j \leq m$ such that $i/j = k/l$... All in all it looks like its going to be a messy task to compute this sum, and to find the standard deviation.

-