The Two-sample Proportion tests are used to test if the samples were drawn from a populations with equal proportions. Both exact and approximate tests may be performed.
The following hypotheses may be tested:
Where and are the population proportions from which samples were drawn.
Where the +/- sign is determined as follows for the above hypothesis:
If we let:
a = np1 | b = np2 | N = a + b + c + d |
c = n1(1 - p1) | d = n2(1 - p2) |
Assuming a+b, c+d, a+c, and b+d as fixed, then the probability of obtaining exactly a and b within the sample is:
This represents the probability of exactly a and b occurrences. These probabilities are calculated for all possible results departing as much or more as a and b. The sum of these probabilities is the one-tailed significance. For two-sided tests the probabilities are calculated for all possible cases where the following is as great or greater than that observed:
The p-value is flagged with an asterisk (*) when p <= alpha.