Hypothesis Tests
Two Proportion Z-Test Calculator
A two-proportion z test asks whether two independent sample proportions differ by more than sampling noise allows under a shared null.
Worksheet
Press Calculate to see the result.
A two-proportion z test asks whether two independent sample proportions differ by more than sampling noise allows under a shared null.
What this calculator answers
A clinic sees 45 successes in 100 patients on regimen A and 30 in 100 on regimen B. The sample proportions are 0.45 and 0.30. Under a null that the true proportions are equal, the usual textbook SE pools the successes and divides by the combined n. The z statistic is the gap between the sample proportions divided by that SE. Unticking the pool box uses separate sample variances instead, which matches a different null framing.
The ticket reports the primary figure first, then the supporting counts and intermediate terms that produced it. Supporting counts and intermediate terms sit under the headline so a reader can see what was divided by what. When a checkbox or a tail setting changes the divisor or the rejection region, that choice appears in the steps rather than vanishing into a silent default.
The formula, written out
Two-proportion z uses this relationship.
z = (p̂1 − p̂2) / SE, with pooled SE = sqrt(p̂(1−p̂)(1/n1+1/n2)) when H0 says p1 = p2
- n. Sample size or count of observations.
- x̄. Sample mean when a mean is used.
- s. Sample standard deviation when a spread is used.
- α. Significance level when a test or critical value is used.
The algebra follows the named textbook identity. Intermediate terms appear in the steps so a hand check can match the ticket. The algebra is the named textbook identity for this worksheet. Intermediate products and quotients appear in order so a calculator and a pencil can agree to the displayed rounding. If a neighbouring page uses a different divisor or a continuity correction, that page says so on its own ticket.
A full worked example
Example loaded in the worksheet
The form is prefilled with a small example so every arithmetic step can be checked by hand. Change one field after you finish the walkthrough and confirm the ticket moves the way the formula predicts.
p̂1 = 45/100 = 0.45; p̂2 = 30/100 = 0.3. Pooled p̂ = (45+30)/(100+100) = 0.375. SE = 0.068465.
z = (0.45 − 0.3) / 0.068465 = 2.1909. The two-sided p-value is 0.0285. At the 0.05 level, the result is in the rejection region. The data are unlikely if the null hypothesis is the whole story.
| Z statistic | 2.1909 |
|---|---|
| P-value | 0.0285 |
| p̂1 − p̂2 | 0.15 |
| SE | 0.068465 |
| Decision | At the 0.05 level, the result is in the rejection region. The data are unlikely if the null hypothesis is the whole story. |
A second situation
Unpooled SE on the same counts
p̂1 = 45/100 = 0.45; p̂2 = 30/100 = 0.3. Unpooled SE uses each sample proportion separately. SE = 0.067639.
z = (0.45 − 0.3) / 0.067639 = 2.2177. The two-sided p-value is 0.0266. At the 0.05 level, the result is in the rejection region. The data are unlikely if the null hypothesis is the whole story.
| Z statistic | 2.2177 |
|---|---|
| P-value | 0.0266 |
| p̂1 − p̂2 | 0.15 |
| SE | 0.067639 |
| Decision | At the 0.05 level, the result is in the rejection region. The data are unlikely if the null hypothesis is the whole story. |
Changing one input that the formula is sensitive to moves the headline while the definition stays fixed on this page. The second example changes the feature that this formula is sensitive to, and the ticket shows the new figure beside the same definition. That contrast is the fastest way to see which input owns the movement.
What moves when the input moves
Sample 1 successes rose from 45 to 55. The headline result went from 2.1909 to 3.576.
The nudged inputs
p̂1 = 55/100 = 0.55; p̂2 = 30/100 = 0.3. Pooled p̂ = (55+30)/(100+100) = 0.425. SE = 0.069911.
z = (0.55 − 0.3) / 0.069911 = 3.576. The two-sided p-value is 0.0003. At the 0.05 level, the result is in the rejection region. The data are unlikely if the null hypothesis is the whole story.
| Z statistic | 3.576 |
|---|---|
| P-value | 0.0003 |
| p̂1 − p̂2 | 0.25 |
| SE | 0.069911 |
| Decision | At the 0.05 level, the result is in the rejection region. The data are unlikely if the null hypothesis is the whole story. |
How to read the result
Say the unit, the sample size, and the formula name in the same sentence as the figure. Say the unit, the sample size or contract terms, and the formula name in the same sentence as the figure. A number without those three pieces invites a later reader to invent a definition that this page never used.
Write the result with its unit, the inputs that produced it, and the name of the formula. Write the result with its unit, the inputs that produced it, and the name of the formula. If the ticket shows a decision sentence, quote the alpha and the tail with it. If the ticket shows a money or dose figure, quote the rate and the schedule that produced it.
Assumptions that have to stay true
- Inputs match the information the formula asks for.
- Units are consistent across every field.
- Missing cells are blank, not typed zeros, unless a zero was observed.
If an assumption above is false, do not average the discomfort away. Change the worksheet or change the question. A correct arithmetic step on the wrong model is still the wrong answer for the decision you are trying to make.
Mistakes that change the answer
- Using a percent where a proportion is required, or the reverse.
- Reading a two-sided p-value as if it were one-sided without checking the tail box.
Where a different calculator is the honest choice
Open a neighbouring calculator when the question changes, rather than forcing this page to answer a different job. Related links under the essay open pages that keep their own formulas instead of hiding a mode switch inside this ticket.
When the job changes, move to a page built for that job: One Proportion Z-Test Calculator, Two Proportion Confidence Interval Calculator, Z-Test Calculator.
Check yourself
Using the loaded example, what is the headline figure?
Run the loaded example and read the first result on the ticket.
Using the result in a sentence
Coursework, lab notes, and survey plans are the usual homes for this worksheet. Keep the count, the unit, and the assumption list beside any copy of the number that leaves this browser tab.
A small sample and a violated assumption both shrink how far the figure can travel. Pair the headline with the steps before you staff a route, set a grade boundary, or compare two contracts from a single number.
Questions people ask next
01What definition does the Two Proportion Z-Test Calculator commit to?
This page uses Two-proportion z: z = (p̂1 − p̂2) / SE, with pooled SE = sqrt(p̂(1−p̂)(1/n1+1/n2)) when H0 says p1 = p2. The algebra follows the named textbook identity. Intermediate terms appear in the steps so a hand check can match the ticket. If a textbook uses a different divisor, a different continuity correction, or a different rounding rule, the last digits can move, so the definition is printed above the result. The worksheet asks for Successes in sample 1, Size of sample 1, Successes in sample 2, Size of sample 2, Alpha, Tail, and related inputs, and it refuses a blank that the formula cannot interpret. Keep that printed definition in the sentence you write next to the figure so a later reader can rebuild the arithmetic without guessing which convention you chose.
02How should the worked example be read out loud?
In the loaded example the z statistic is 2.1909. Say the unit, the sample size, and the formula name in the same sentence as the figure. Say the unit and the count before you say whether the number is large or small. Read the steps in order rather than jumping to the headline, because the intermediate terms are where a swapped percent and proportion usually hide. If the ticket shows both a primary figure and a comparison figure, name which one you are quoting.
03What is the fastest way to get a misleading result?
Using a percent where a proportion is required, or the reverse. A small sample and a violated assumption both shrink how far the figure can travel. A second common failure is leaving a checkbox or tail setting in the wrong state and then treating the number as if the default had matched your plan. Reset the example, change one input, and confirm the ticket moves in the direction the formula predicts before you trust a live run.
04When should I leave this page for a different calculator?
Open a neighbouring calculator when the question changes, rather than forcing this page to answer a different job. The related links under the essay go to those worksheets, which keep their own formulas instead of hiding them in a mode switch. If the question changed from a summary to a test, from a payment to a refinance, or from a raw score to a percentile, switch pages rather than forcing this ticket to answer a job it was not built for.
05What belongs in the sentence next to the number?
Run the loaded example and read the first result on the ticket. Name the formula, the sample size or the inputs, and the unit before you compare the figure with someone else's. A bare number without those three pieces cannot be audited when a score, a rate, or a lab value is challenged later. Store the inputs beside the result whenever the figure will travel into a report.