3
$\begingroup$

Let $X \sim \mathrm{Binomial} (n, p_1)$ and let $Y \sim \mathrm{Binomial} (n, p_2)$ with $n, p_1$ and $p_2$ known and $p_1 < p_2$.

What is the probability that a sample value $x$ drawn from $X$ is smaller than a sample value $y$ drawn from $Y$? That is, what is $P(X<Y)$?

$\endgroup$
  • $\begingroup$ Yes; that a sample drawn from X is smaller than another sample drawn from Y. $\endgroup$ – Andrew Dec 5 '12 at 23:16
  • $\begingroup$ The trick here is to use the law of total probability; if you know that $Y=y$, then you can calculate $P(X<y)$, by summing $X$'s probability mass function, $P(X=x) = \binom{n}{x} p_{1}^{x} (1-p_1)^{n-x}$, over $x=0,...,y$. Then you just take the expected value of that quantity, with respect to $Y$. Btw, the result is probably not going to look pretty :) $\endgroup$ – Macro Dec 5 '12 at 23:16
  • $\begingroup$ And if $Y=y$ can take any value, one would multiply $P(Y=y)$ with $P(X<y)$. Is this correct? $\endgroup$ – Andrew Dec 5 '12 at 23:20
  • $\begingroup$ Yes, and sum over the whole domain $y=0,1,...,n$. This is what I meant by taking the expected value with respect to $Y$ $\endgroup$ – Macro Dec 5 '12 at 23:22
  • 2
    $\begingroup$ $P(X<Y)$ is equivalent to $P(X-Y<0)$; in turn, that's $P(X+(-Y)<0)$ which equals $P(X+(n-Y)<n)$, and $(n-Y)\sim \rm{Bin}(n,1-p_2)$; each can be useful. If $n$ is not really large you can do the last by numerical convolution; I've done some decent-sized ones in R on negative binomials in the past; binomials are even better suited to it. If $n$ is not small and the $p$'s are not really close to the boundaries (the two are linked), you can approximate this probability pretty well using normal distributions (I'd suggest using a continuity correction on the difference $X-Y$ and comparing to 0). $\endgroup$ – Glen_b -Reinstate Monica Dec 6 '12 at 0:43
2
$\begingroup$

Although an explicit formula might be tricky, it's quite easy to evaluate numerically. The key is to realize the $X$ and $Y$ are independent.

Start by pretending you know $Y=y$. You know that if $X \sim \mathcal{B}(n_1,p_1)$ then: $$P[X=x] = \binom{n_1}{x}p_1^x(1-p_1)^{n_1-x}$$

From there you can easily find: $$P[X \le y] = \sum_{x=0}^{y} \binom{n_1}{x}p_1^x(1-p_1)^{n_1-x}$$

Because $X$ and $Y$ are independent, we know: $$P[X<Y] = \sum_{y=0}^{n_2}P[X<y] * P[Y=y]$$ $$= \sum_{y=0}^{n_2}\left(\sum_{x=0}^{y} \binom{n_1}{x}p_1^x(1-p_1)^{n_1-x}\right)\binom{n_2}{y}p_2^y(1-p_2)^{n_2-y}$$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.