initiate gp1, g1, gp2, g2 //The number of positive cases in Group1, Group1 total cases, positive cases in Group2, Group2 total cases. average = (gp1+gp2)/(g1+g2) flag = gp1/g1 - gp2/g2 if(flag >= 0){ joint1 = BINOM.DIST(gp1-1;g1;average) // Left-side binomial disribution joint2 = 1 - BINOM.DIST(gp2;g2;average) // Right-side binomial disribution } else { joint1 = 1 - BINOM.DIST(gp1;g1;average) joint2 = BINOM.DIST(gp2-1;g2;average) } joint = joint1 * joint2 ebt_p = 1 - joint