Probability than empirical mean of one binomial RV smaller than another Lets suppose I have two binomial random variables: $X \sim B(n_1, p_1)$ and $Y \sim B(n_2, p_2)$. I would like to calculate the probability than the empirical mean of $X$ be smaller than the empirical mean of $Y$:
$P(\frac{\sum_{i=1}^{n_1} X_i}{n_1} < \frac{\sum_{k=1}^{n_2} Y_i}{n_2})$  
 A: If $n_1, n_2$ are large you can use a normal approximation, else it is not difficult ti write an explicit exact expression which can be used for small indices. Your notation is a bit ambiguous, sums of independent binomials with the same $p$ are binomial, I guess you mean a sum over bernoulli (indicator) variables.  
Assume that $X, Y$ are inbdependent random variables (you did'nt say they are independent, but without that assumption little to do, so I assume that). $X \sim \text{Bin}(n_1,p_1), \quad Y \sim \text{Bin}(n_2, p_2)$. Then 
$$ \DeclareMathOperator{\P}{\mathbb{P}}
\P(X < \frac{n_1}{n_2} Y) = \sum_{[y=0}^{n_2} \P(X < \frac{n_1}{n_2} y)\P(Y=y) = \\ \sum_y \sum_{k=0}^{[n_1 y/n_2]} \binom{n_1}{k}\binom{n_2}{y}
p_1^k (1-p_1)^{n_1-k} p_2^y (1-p_2)^{n_2-y}
$$
where $[n_1 y/n_2]$ is the largest integer less than its argument.  That is onky useful for numerical use, so I will show an example in R:
intpart  <-  Vectorize( function(f) {
    if (round(f)==f) (f-1) else floor(f)  
} )

probless  <-  function(p1,p2,n1,n2) {
sum( pbinom(intpart(n1*(0:n2)/n2), n1, p1) * dbinom((0:n2),n2,p2) )
}

p1 <- 0.5
p2 <- 0.7
n1 <- 10
n2 <- 20

probless(p1, p2, n1, n2)

and running this code:  
probless(p1, p2, n1, n2)
[1] 0.8221092

You yourself can compare this answer with the normal approximation. 
