# Statistical comparison between binomial distributions, two groups and many trials

I have a data set with two groups. I have multiple trials with different Ns in each trial, and different numbers of trials for each group. In each trial, for each group, I am counting the number of successes.

How can I estimate the proportion of successes for each group under a binomial distribution (i.e. success or failure), with confidence intervals? How can I test whether the proportion of successes is the same between the two groups?

The standard Z-test for proportions is only described for one trial per group.

This question wasn't sufficient: Determining statistical significance of difference between two binomial distributions

• The N samples within a single trial are not perfectly independent, but it is fairly reasonable to assume independence. – Dylan Richard Muir Jul 3 '15 at 9:22
• Do you have the outcomes for each individual in each trial (in each group)? – Daniel Jul 3 '15 at 9:29
• @Daniel: Sorry if I misunderstand your question. For each of the N individual samples in each trial (in each group), I know the outcome -- either success or failure. – Dylan Richard Muir Jul 3 '15 at 9:33
• But do you know which individual is responsible for each sample in each trial? e.g. if group A has 3 individuals (a, b, c), and the first trial for group A has 5 samples, do you have (1, 0, 1, 1, 0), or ({1, b}, {0, a}, {1, c}, {1, a}, {0, b})? – Daniel Jul 3 '15 at 10:57
• Individuals are only sampled once, and are not repeated across groups or across trials. Individual ID can therefore be neglected: group A trial 1 is (1, 0, 1, 1, 0). – Dylan Richard Muir Jul 3 '15 at 14:24

$\sum_{i=1}^{|G_{1}|}X_{i}$ ~Bin($\sum_{i=1}^{|G_{1}|}N_{i}^{1}$, p) and $\sum_{i=1}^{|G_{2}|}Y_{i}$ ~ Bin($\sum_{i=1}^{|G_{2}|}N_{i}^{2}$,p)