The same comparison as the previous two sections, with categorical data. The parameter is the difference of two population proportions, the point estimate is the difference of the two sample proportions, and because the difference of two proportions follows an approximate normal distribution, the test statistic is a z-score with no degrees of freedom. One feature is genuinely new and is the section's central idea: because the null hypothesis generally states that the two proportions are the same, the two samples are estimating one common value, so their successes and their trials are combined into a single pooled proportion before the standard error is formed. That is the opposite of the instruction in section 10.1, and the reason is that a binomial's spread follows from its probability — so a null of equal proportions is also a null of equal spreads, while a null of equal means says nothing about the two standard deviations.
Subject: Statistics · 67 slides · symbolic lesson
Open the interactive version of this deck
Title
Statistics · Chapter 10 — Hypothesis Testing with Two Samples
Two shares instead of two averages: pool the samples, then a z test
Objectives
Sections 10.1 and 10.2 compared two population means. This section asks the same question of yes-or-no data: is the share of one population with some outcome different from the share of another? Did more adults still have hives on one medication, do fewer women skip seat belts, do more younger adults own electric cars?
The arithmetic is shorter than in Section 10.1: no degrees of freedom, no t table. What is new is one idea, the pooled proportion, and it comes with a reason. Every example ends with a sentence about the two populations that you could read aloud to someone who has never met a p-value.
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, pp. 523-527 — the section this deck covers
Warm-up
Everything in this section is built from a piece you met in Section 9.5: the standard deviation of one sample proportion when the null hypothesis names the population proportion. Work it for a single sample before combining two.
Discussion prompt
A null hypothesis says 8 percent of adults on a medication still have hives after 30 minutes. A sample of 200 adults is taken. What is the standard deviation of the sample proportion under that null, and why does it come from the null value rather than from the sample?
Hold on to two facts. First, 0.0192 is the spread of one proportion out of 200 adults. Second, the spread came from the proportion itself, with nothing else needed. That second fact is the whole reason this section pools its samples, and you will see it again in Part 2.
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §9.5 — the test statistic for a single proportion
Section
Part 1
Concept
Example 10.8 tests two medications for hives. A random sample of 200 adults takes medication A; a separate random sample of 200 takes medication B. Thirty minutes later each adult either still has hives or does not. Nothing is measured; each person contributes one yes or one no.
Figure (svg): Two grids of 200 small circles each, 20 across and 10 down. In the left grid, for medication A, the first 20 circles are filled orange; in the right grid, for medication B, the first 12 are filled blue. The rest are hollow.
So the natural summary of each sample is a proportion: the number of adults still with hives divided by the number in the sample. The book writes a sample proportion with a prime, p-prime, to keep it apart from the population proportion p it estimates.
\[ p'_A = \frac{x_A}{n_A} = \frac{20}{200} = 0.10, \qquad p'_B = \frac{x_B}{n_B} = \frac{12}{200} = 0.06 \]
The samples differ by four percentage points. If the two medications are truly equally effective, two random samples would still rarely give identical shares, so four points could be chance. Or medication B could genuinely leave fewer adults with hives. Deciding between those two stories is the job of the test.
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, p. 523 — Example 10.8
Concept
As with two means, you compare two proportions through one number, their difference. Before the samples are drawn it is a random variable, because a different pair of samples would give a different difference. The book writes it with capital letters.
\[ P'_A - P'_B = \text{difference in the proportions still with hives} \]
The parameter it estimates is the difference of the population proportions. Your hypotheses are always about these population values, never about the sample shares, which you already know exactly.
\[ p_A - p_B = \text{true difference, unknown} \]
The order of subtraction is a choice, but once made it must be kept everywhere: in the hypotheses, in the numerator of the statistic and in the picture. A difference written A minus B is positive when A's share is larger. Choose the order that makes the claim read naturally, usually the group named first in the question minus the other.
The book says the difference of two proportions follows an approximate normal distribution. That is the same reason a single proportion was approximately normal in Chapter 9: each one is a count of successes divided by n, and counts of many independent yes-or-no trials pile up in a bell shape. A difference of two such bells is again a bell.
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, p. 523 — the sampling distribution for differences in sample proportions
Concept
Generally the null hypothesis states that the two population proportions are the same. You can write that as an equality of two proportions or, equivalently, as a difference of zero. The second form matches the random variable, and it names one value to centre the curve on.
\[ H_0: p_A = p_B \iff p_A - p_B = 0 \]
The alternative comes from the words of the claim, exactly as in Chapter 9. A difference, or not the same, gives a not-equal sign and a two-tailed test. Greater than or more gives a right tail; less than or fewer gives a left tail, provided the subtraction runs in the order you chose.
\[ H_a: p_A \ne p_B, \quad H_a: p_A > p_B, \quad \text{or} \quad H_a: p_A < p_B \]
Notice the null is an equality in all three cases, even when the alternative points one way. The book writes it as an equality throughout this section. Some texts write the one-tailed null with an at-most sign; the test is computed at the equality either way, because that boundary is where the null is hardest to reject.
And the null being an equality is what makes the next part possible. If the two proportions are equal, the two samples are estimates of one and the same number, and you are entitled to combine them.
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, p. 523 — generally, the null hypothesis states that the two proportions are the same
Sorting
The first decision in every Chapter 10 problem is what each individual contributes. A yes-or-no outcome means proportions; a measured number means means. Sort each comparison by what one person or object in it gives you.
Sort into buckets
Sort each comparison by the parameter it compares.
The exam score is the one that catches people: it is written as a percent, but each person's percent is a measurement to be averaged, not a yes or a no. Ask what one person contributes, not how the number is printed.
The same question works in reverse. The share of valves that crack is a proportion even though the engineers measured pressure, because the data recorded for each valve is only whether it cracked at 4,500 psi. What was recorded, not what could have been recorded, decides the test.
Worked example
Two types of medication for hives are tested to determine if there is a difference in the proportions of adults who still react after 30 minutes. Test at the 1 percent level. Before any arithmetic, name the case, the variable and the hypotheses.
Name the case
Why: each adult gives a yes or a no, and the two samples are separate random samples: two independent proportions.
\[ \text{two independent population proportions} \]
Name the parameters
Why: one population proportion for each medication.
\[ p_A, p_B = \text{proportion of all adults still with hives} \]
Write the random variable
Why: a difference of the two sample proportions, A minus B.
\[ P'_A - P'_B \]
Translate is a difference
Why: no direction is claimed, so a not-equal sign goes in the alternative.
\[ H_a: p_A \ne p_B \iff p_A - p_B \ne 0 \]
Write the null as its complement
Why: the null holds the equality.
\[ H_0: p_A = p_B \iff p_A - p_B = 0 \]
Because the alternative has a not-equal sign, a difference far from zero on either side is evidence against the null. Medication A being worse and medication A being better both count, so the p-value will be the area in both tails.
Read the significance level
Why: fixed before the data, and strict: one study in a hundred.
\[ \alpha = 0.01 \]
A strict level suits a medical comparison. Declaring a difference between medications that is not real could steer doctors toward one drug for no reason, so the study demands strong evidence before it says so. The price, as you will see, is that a modest real difference can go undetected.
Check the hypotheses against the question
Why: the question asks about a difference, the alternative says not equal, and the null names the single value zero.
\[ \text{claim} \to H_a, \quad \text{equality} \to H_0 \quad \checkmark \]
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, pp. 523-524 — Example 10.8
Prediction
Example 10.10 tests a marketing firm's claim that the proportion of younger adults owning electric vehicles is greater than the proportion of older adults. Before writing anything, decide which difference to compute so the claim points to the right tail.
Predict first
With the alternative that younger adults have the greater proportion, which difference makes the test right-tailed?
Correct: p′Y − p′O, younger minus older
Why: If the younger proportion is larger, younger minus older is positive, so evidence for the claim lands in the right tail. Subtracting the other way would turn the same claim into a left-tailed test.
Older minus younger is not wrong in itself: it would give a left-tailed test with the same p-value. The mistake is mixing them, writing the alternative one way and the statistic the other, which sends the p-value to the wrong tail and turns a strong result into a p-value near one.
The habit that prevents it: choose the order once, write it in the random variable, and copy that line into the hypotheses and the numerator without re-deciding.
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, pp. 526-527 — Example 10.10: the words greater than indicate a right-tailed test
Worked example
A researcher believes that the proportion of women not wearing seat belts is less than the proportion of men not wearing them. A random sample of United States adults gives the counts below. Test at the 1 percent level.
| men | women | |
|---|---|---|
| does not wear seat belts | 183 | 156 |
| total surveyed | 2,231 | 2,169 |
Read the table by columns: each column is one sample, with its count of the outcome on top and its sample size below. The outcome counted is not wearing a seat belt, so that is the success for this test, however unwelcome it is on the road.
Name the case
Why: each adult wears a belt or does not; men and women are two independent groups.
\[ \text{two independent population proportions} \]
Choose subscripts and order
Why: F for women and M for men, women first because the claim is about women.
\[ P'_F - P'_M \]
Translate less than
Why: the women's proportion is smaller, so women minus men is negative.
\[ H_a: p_F < p_M \iff p_F - p_M < 0 \]
Write the null
Why: equal proportions.
\[ H_0: p_F = p_M \iff p_F - p_M = 0 \]
The book names the random variable in words as the difference for men and women, yet writes women minus men in symbols. The symbols are what count: with women first, the claim less than is a left tail. Had you written men minus women, the same claim would become a right tail.
Compute the two sample proportions
Why: each count over its own total.
\[ p'_F = \frac{156}{2169} \approx 0.0719, \qquad p'_M = \frac{183}{2231} \approx 0.0820 \]
Check the direction of the data against the alternative
Why: women minus men is negative, the direction the alternative predicts, so the test can find evidence; the question is whether it is enough.
\[ 0.0719 - 0.0820 = -0.0101 < 0 \quad \checkmark \]
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, p. 525 — Example 10.9 and Table 10.12
Trap
A first attempt at Example 10.8 puts the sample proportions in the hypotheses:
\[ H_0: p'_A = p'_B \]
\[ H_a: p'_A \ne p'_B \]
\[ 0.10 \ne 0.06 \Rightarrow \text{reject} \]
Wrong. The sample shares are known; there is nothing to test.
Hypotheses are about the populations, which you cannot see. The samples are the evidence for or against them.
\[ H_0: p_A = p_B \]
\[ H_a: p_A \ne p_B \]
The sample shares 0.10 and 0.06 certainly differ, but two random samples from equal populations almost always differ by something. The test asks whether a gap of 0.04 is bigger than chance usually produces. That is a question only the standard error can answer.
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, p. 523 — pA and pB are the desired population proportions
Section
Part 2
Concept
To get a p-value you have to know the spread of the difference of sample proportions when the null is true. The spread of a proportion depends on the proportion itself, so you need a value for it. Which value?
The null answers: the two population proportions are the same number. Call it p. Then both samples are estimating p, and the honest estimate uses all of the evidence at once: every success from both samples over every trial from both samples. That is the pooled proportion.
\[ p_c = \frac{x_A + x_B}{n_A + n_B}, \qquad q_c = 1 - p_c \]
The subscript c stands for combined. It is not a new kind of proportion, just the sample proportion of the combined sample, which under the null is one big random sample from one population.
Figure (svg): One grid of 400 circles, 40 across and 10 down. Twenty circles are filled orange and twelve are filled blue, 32 filled in all; the rest are hollow. Beneath it: 32 of 400 equals 0.08.
The pooled value is used only to build the standard error. The numerator of the test statistic still compares the two separate sample proportions, because their gap is the evidence. You pool to describe the world the null imagines, not to erase the difference you are testing.
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, p. 523 — to conduct the test, we use a pooled proportion, pc
Concept
To see why pooling is legitimate, look at a single adult in the hives study. Code the outcome as 1 if the adult still has hives and 0 if not. A sample proportion is then just the mean of these zeros and ones: 20 ones among 200 values average to 0.10.
Now find the variance of one coded outcome when the population proportion is p. The value 1 occurs with probability p and the value 0 with probability q, so the mean is p. Each squared distance from that mean, weighted by its probability, gives the variance.
\[ \text{Var} = p(1 - p)^2 + q(0 - p)^2 \]
\[ \text{Var} = pq^2 + qp^2 = pq(q + p) = pq \]
The last step uses q plus p equals one. So the variance of a single yes-or-no outcome is p times q, and nothing else: once you know the proportion, you know the spread. There is no separate standard deviation to estimate, as there was for measurements.
Dividing by n gives the variance of a sample proportion, pq over n, which is the formula from the warm-up. The pooling argument on the next slide rests entirely on this one line of algebra.
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, p. 523 — the distribution for the differences
Picture it
Section 10.1 insisted that the two sample variances be kept separate. This section combines the samples. The rules are opposite because the two null hypotheses say different things about spread.
Figure (svg): A curve of the standard deviation of one yes-or-no outcome, the square root of p times one minus p, for p from 0 to 1. It rises from 0 to a peak of 0.5 at p equals one half and falls back to 0. Dots mark p equals 0.06 at 0.237, 0.08 at 0.271 and 0.10 at 0.300.
For a yes-or-no outcome, the spread of one observation is the square root of p times q. There is no separate spread to set: the proportion decides it. So a null saying the two proportions are equal also says the two spreads are equal, and one pooled estimate serves both.
A mean is different. Two populations can share a mean and have completely different standard deviations, think of two machines filling bottles to the same average with one far sloppier than the other. A null about means fixes nothing about spread, so Section 10.1 had to estimate each spread separately.
Short version: pool when the null determines the spread, keep separate when it does not. For proportions it always does.
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, p. 523 — the null hypothesis states that the two proportions are the same
Notation
The formula is short, but each piece carries a decision. Hover over each part; together they say total successes over total trials, which is all pooling is.
Annotate
On: \( p_c = \frac{x_A + x_B}{n_A + n_B} \)
When a problem gives percentages instead of counts, turn them back into counts first: a share times its sample size. Adding the two percentages and dividing by two is a different and generally wrong number, and Part 2 has a trap on exactly that.
A quick sense check for any answer: with equal sample sizes the pooled proportion is exactly midway between the two sample proportions; with unequal sizes it sits nearer the bigger sample.
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, p. 523 — the pooled proportion is calculated as follows
Worked example
Twenty of 200 adults on medication A and twelve of 200 on medication B still had hives. Pool them for the null's common proportion, one move per line.
Write the counts
Why: successes are the outcome being counted, here still having hives.
\[ x_A = 20, \; n_A = 200; \qquad x_B = 12, \; n_B = 200 \]
Adding counts is legitimate because, under the null, an adult on medication A and an adult on medication B are the same kind of draw from the same population. The dashed line between the two groups in the next picture carries no information if the null is true.
Add the successes
Why: the counts from both samples.
\[ x_A + x_B = 20 + 12 = 32 \]
Add the trials
Why: both sample sizes.
\[ n_A + n_B = 200 + 200 = 400 \]
Divide
Why: successes over trials.
\[ p_c = \frac{32}{400} = 0.08 \]
Take the complement
Why: the pooled share without hives.
\[ q_c = 1 - 0.08 = 0.92 \]
So if the medications are equally effective, about 8 percent of all adults would still have hives after 30 minutes on either one. That is the world in which the p-value will be computed.
Check that it sits between the samples
Why: with equal sample sizes it must be exactly the midpoint of 0.10 and 0.06.
\[ \frac{0.10 + 0.06}{2} = 0.08 \quad \checkmark \]
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, pp. 523-524 — Example 10.8
Concept
Why does the pooled proportion always land between the two sample proportions? Rewrite each count as its sample's proportion times its sample size, which is just the definition of a proportion run backwards.
\[ x_A = n_A p'_A, \qquad x_B = n_B p'_B \]
Substitute into the pooled formula. The pooled proportion becomes the two sample proportions, each weighted by its own share of all the trials.
\[ p_c = \frac{n_A p'_A + n_B p'_B}{n_A + n_B} = \frac{n_A}{n_A + n_B} p'_A + \frac{n_B}{n_A + n_B} p'_B \]
The two weights are positive and add to one, so the result is a weighted average and must lie between the two proportions. The bigger sample gets the bigger weight, which is right: it carries more information about the common proportion.
Figure (svg): A number line from 0.04 to 0.12. A tall orange block, its height standing for 1,343 younger adults, sits at 0.1005; a short blue block for 232 older adults sits at 0.0517. A filled yellow pivot under the line at 0.0933 marks the pooled proportion, close to the tall block. A hollow red pivot at 0.0761 marks the plain average of the two proportions.
Here is Example 10.10: 1,343 younger adults and 232 older ones. The younger sample is nearly six times larger, so its weight is 0.853 and the pooled proportion sits close to its 0.1005, not midway.
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, pp. 526-527 — Example 10.10
Estimation
Example 10.10 gives two samples of very different size: 1,343 younger adults, about 10 percent owning an electric vehicle, and 232 older adults, about 5 percent. Decide roughly where the pooled proportion sits before doing any arithmetic.
Predict first
Roughly where does the pooled proportion for the electric-vehicle samples fall?
Correct: about 0.093, close to the younger sample
Why: The pooled proportion weights each sample by its size. The younger sample holds about 85 percent of all the people, so the pooled value sits about 85 percent of the way from 0.05 to 0.10, near 0.093.
Here is the arithmetic behind the estimate. The younger adults are 1,343 of 1,575 people, about 0.85 of the total, so the pooled value is about 0.05 plus 0.85 of the five-point gap, which is 0.05 plus 0.0425, roughly 0.093.
Estimating first is a cheap guard. If your calculation comes out near 0.075, you have averaged the two percentages instead of pooling the counts; near 0.15, you have added proportions as though they were counts.
The rough rule: the pooled value is pulled toward the larger sample in proportion to its share of all the trials. Equal sizes, the midpoint; one sample six times the other, most of the way to the big one.
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, p. 526 — Example 10.10
Worked example
The survey reports percentages: 10 percent of 1,343 younger adults and 5 percent of 232 older adults own electric vehicles. Pooling needs counts, so recover them first, and look hard at what comes out.
Turn the younger percentage into a count
Why: share times sample size.
\[ 0.10 \times 1343 = 134.3 \]
Turn the older percentage into a count
Why: the same move.
\[ 0.05 \times 232 = 11.6 \]
Neither is a whole number of people, so both percentages were rounded. The book's calculator instructions enter the true counts, 135 and 12, and those are the numbers to use. They give slightly different proportions from the rounded ones.
Use the real counts
Why: from the book's calculator entries.
\[ p'_Y = \frac{135}{1343} \approx 0.1005, \qquad p'_O = \frac{12}{232} \approx 0.0517 \]
Add the successes and the trials
Why: pooling always works with counts.
\[ 135 + 12 = 147, \qquad 1343 + 232 = 1575 \]
Divide
Why: the pooled proportion of owners.
\[ p_c = \frac{147}{1575} \approx 0.0933, \qquad q_c \approx 0.9067 \]
Under the null, then, about 9.3 percent of all adults own an electric vehicle, whatever their age. The value sits close to the younger sample's 10 percent because the younger adults are 85 percent of everyone surveyed, exactly as the estimate on the previous slide predicted.
Check as a weighted average
Why: weights 1,343 and 232 out of 1,575.
\[ 0.8527(0.1005) + 0.1473(0.0517) \approx 0.0933 \quad \checkmark \]
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, pp. 526-527 — Example 10.10 and its calculator entries 135 and 12
Fill the middle
Try It 10.8 tests two types of valve for pressure tolerance. Fifteen of a random sample of 100 type A valves cracked under 4,500 psi, and six of 100 type B valves cracked. Fill in the pooled proportion, its complement and the product the standard error will need.
Fill in the blanks
p_c = \frac210.105 = \frac0.895}0.093975 = ___, \quad q_c = ___, \quad p_c q_c = ___
Why: Twenty-one cracked valves out of two hundred gives 0.105. Its complement is 0.895, and their product is 0.093975, which the standard error will multiply by one over 100 plus one over 100.
Check the result the quick way: the samples are the same size, so the pooled value must be the midpoint of 0.15 and 0.06, which is 0.105. It is.
The product 0.093975 is the pooled pq: the variance of one valve's crack-or-not outcome in the world where both types crack equally often. The standard error will scale it by the two sample sizes on the full test slide later in the deck.
Notice what is being counted. A success here is a valve that cracked, which is a failure for the engineers. In statistics a success is simply the outcome you are counting, good or bad, and the test is the same whichever one you call success.
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, p. 524 — Try It 10.8
Trap
A first attempt at pooling Example 10.10 averages the two sample proportions:
\[ p_c = \frac{0.1005 + 0.0517}{2} \]
\[ p_c = 0.0761 \]
Wrong. That treats 232 people as if they were 1,343.
Pool counts over trials, so each sample is weighted by its size:
\[ p_c = \frac{135 + 12}{1343 + 232} \]
\[ p_c = \frac{147}{1575} = 0.0933 \]
The plain average is right only when the two samples are the same size, which is why it gives the correct 0.08 for the hives example and hides the mistake there. With unequal samples it is off; here it moves the pooled value by almost two percentage points.
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, pp. 526-527 — Example 10.10
Counterexample
The trap just said the plain average of the two sample proportions is generally wrong. But in Example 10.8 and Try It 10.8 it gave exactly the right answer. Find the condition that makes it work, and a pair of samples where it fails badly.
Discussion prompt
For which samples does the average of the two sample proportions equal the pooled proportion? Give a pair of samples where the two differ by a lot.
The lesson: the hives example cannot tell you whether someone pooled correctly, because both methods agree there. Only an unequal-size example exposes the averaging habit, which is why Example 10.10 is the one to practise on.
Section
Part 3
Concept
Under the null, both samples come from one population with proportion p. Each sample proportion then has the one-sample variance you met in the warm-up, with its own n.
\[ \text{Var}(P'_A) = \frac{pq}{n_A}, \qquad \text{Var}(P'_B) = \frac{pq}{n_B} \]
The samples are independent, so the variance of their difference is the sum of the two variances. Variances add even when the quantities are subtracted, because a chance high in one sample pushes the difference just as far as a chance low in the other.
\[ \text{Var}(P'_A - P'_B) = \frac{pq}{n_A} + \frac{pq}{n_B} = pq\left(\frac{1}{n_A} + \frac{1}{n_B}\right) \]
The true p is unknown, so put in its best estimate under the null, the pooled proportion, and take the square root to get back to the scale of a proportion.
\[ SE = \sqrt{p_c q_c \left(\frac{1}{n_A} + \frac{1}{n_B}\right)} \]
The factoring in the third line is the visible trace of pooling: the same pq multiplies both pieces, because the null says both populations share it. In Section 10.1 the two pieces had different variances and nothing could be factored out.
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, p. 523 — the distribution for the differences
Intuition
The book states that the difference of two proportions follows an approximate normal distribution. It is worth seeing where that comes from, because the counts condition in Part 4 is exactly the price of the approximation.
Each sample proportion is a count of successes divided by n, and a count of independent yes-or-no trials is binomial. When the expected numbers of successes and failures are both comfortably large, a binomial histogram is a nearly symmetric bell, so each sample proportion is close to normal.
\[ P'_A \approx N\left(p, \sqrt{\frac{pq}{n_A}}\right), \qquad P'_B \approx N\left(p, \sqrt{\frac{pq}{n_B}}\right) \]
The difference of two independent normal quantities is again normal, with the means subtracting and the variances adding. Under the null both means are the same p, so the difference is centred at zero.
\[ P'_A - P'_B \approx N\left(0, \sqrt{pq\left(\frac{1}{n_A} + \frac{1}{n_B}\right)}\right) \]
Where can this go wrong? When a count is small. A proportion of 3 out of 150 cannot go below zero but can stretch far to the right, so its histogram is lopsided and the normal tails misstate the p-value. That is why the condition asks for at least five successes and five failures in each sample, not just a large total.
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, p. 523 — the difference of two proportions follows an approximate normal distribution
Notation
The book writes the null distribution of the difference and the z statistic built from it. Hover over each piece of the statistic; every one has a job, and one of them is usually zero.
Annotate
On: \( z = \frac{(p'_A - p'_B) - (p_A - p_B)}{\sqrt{p_c q_c \left(\frac{1}{n_A} + \frac{1}{n_B}\right)}} \)
The whole fraction reads as one sentence: how many standard errors the observed gap lies from the gap the null expects. Because the difference is approximately normal and nothing about its spread is estimated beyond the proportion itself, the result is read on the standard normal curve. There are no degrees of freedom to find.
\[ P'_A - P'_B \sim N\left(0, \sqrt{p_c q_c \left(\frac{1}{n_A} + \frac{1}{n_B}\right)}\right) \]
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, p. 523 — the test statistic (z-score)
Worked example
With the pooled proportion 0.08 from Part 2, build the standard error for the hives study one move per line. Keeping each product visible is what lets you find a slip later.
Write the formula with the numbers
Why: pooled proportion 0.08, complement 0.92, two samples of 200.
\[ SE = \sqrt{(0.08)(0.92)\left(\frac{1}{200} + \frac{1}{200}\right)} \]
Multiply the pooled proportion by its complement
Why: the pq of one adult.
\[ (0.08)(0.92) = 0.0736 \]
Add the reciprocals of the sample sizes
Why: one term per sample.
\[ \frac{1}{200} + \frac{1}{200} = 0.005 + 0.005 = 0.01 \]
Keep the reciprocals inside the bracket and add them before multiplying. Writing one over 400, as if the two samples were one, is a tempting shortcut that gives the spread of a single proportion from 400 adults, which is not the spread of a difference.
Multiply
Why: this is the variance of the difference.
\[ 0.0736 \times 0.01 = 0.000736 \]
Take the square root
Why: back to the scale of a proportion.
\[ SE = \sqrt{0.000736} \approx 0.02713 \]
So a difference of sample proportions from studies like this typically lands about 2.7 percentage points from the true difference. The observed gap is 4 points, about one and a half of those, which already suggests the p-value will not be tiny.
Check against the one-sample error
Why: two equal samples should give the warm-up's single-sample error times the square root of two.
\[ 0.0192 \times \sqrt{2} = 0.0192 \times 1.4142 \approx 0.0271 \quad \checkmark \]
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, pp. 523-524 — Example 10.8
Worked example
Standardise the observed difference and find its two-tailed p-value. The null's value for the difference is zero, so the numerator is just the observed gap.
Find the observed difference
Why: A minus B, in the order of the hypotheses.
\[ p'_A - p'_B = 0.10 - 0.06 = 0.04 \]
Subtract the null's value
Why: the null says the difference is 0.
\[ 0.04 - 0 = 0.04 \]
Divide by the standard error
Why: measure the gap in standard errors.
\[ z = \frac{0.04}{0.02713} \approx 1.4744 \]
A z of about one and a half says the observed gap is one and a half typical chance gaps from zero. On any normal curve, roughly 7 percent of the area lies beyond 1.5 standard deviations on one side, so the p-value will be about twice that.
Find the area beyond z in one tail
Why: the standard normal curve.
\[ P(Z > 1.4744) \approx 0.0702 \]
Double it
Why: the alternative says not equal, so a gap of 0.04 the other way would be just as surprising.
\[ p\text{-value} = 2 \times 0.0702 = 0.1404 \]
Figure (svg): A normal curve centred at 0 with standard deviation 0.0271, for the difference in proportions from minus 0.1 to 0.1. Yellow lines mark plus and minus 0.04. Both tails beyond them are shaded red, each labelled 0.0702, total p-value 0.1404.
Read it in words: if the two medications were equally effective, about 14 percent of pairs of studies like this one would show a gap of four points or more, one way or the other. That is not rare.
Check against the book's calculator output
Why: 2-PropZTest with 20, 200, 12, 200 and not equal.
\[ z = 1.47, \quad p = 0.1404 \quad \checkmark \]
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, p. 524 — Example 10.8: p-value = 0.1404, test statistic 1.47
Worked example
Two equivalent ways to decide, then a sentence about the populations. The decision is about the null; the conclusion is about medications and adults.
Compare the p-value with alpha
Why: alpha was set at 1 percent before the data.
\[ \alpha = 0.01 < 0.1404 = p\text{-value} \]
Decide
Why: the result is not rarer than the risk accepted.
\[ \text{do not reject } H_0 \]
Figure (svg): A standard normal curve from minus 3.5 to 3.5. Dashed red lines at minus 2.576 and 2.576 bound two small red tails, the 1 percent rejection region. A yellow line marks z equals 1.47, well inside the region between them.
Confirm with the critical value
Why: at 1 percent two-tailed the cutoff is 2.576 on each side.
\[ |z| = 1.47 < 2.576 \]
The picture shows why the two methods agree. The red tails hold 1 percent of the curve in all; the statistic sits well inside them, and the area beyond it, 14 percent counting both sides, is far more than the red 1 percent.
Conclusion in context: at the 1 percent level, from the sample data, there is not sufficient evidence to conclude that there is a difference in the proportions of adult patients who still react after 30 minutes to medication A and to medication B.
That sentence does not say the medications are equally good. The data are consistent with no difference, and also with a real difference of a few points that 200 adults per medication could not detect. At the 5 percent level, with its cutoff of 1.96, the answer would still be not to reject.
Check the decision both ways agree
Why: the statistic falls short of the cutoff exactly when the p-value exceeds alpha.
\[ 1.47 < 2.576 \iff 0.1404 > 0.01 \quad \checkmark \]
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, p. 524 — Example 10.8: Figure 10.7 and the conclusion
Worked example
A non-significant result invites a follow-up question: how big would the gap have had to be? Work it out from the standard error, assuming the pooled proportion stays near 0.08. This is your own extension of Example 10.8, not a book example.
Recall the standard error
Why: pooled 0.08, 200 adults per medication.
\[ SE \approx 0.02713 \]
Find the cutoff for a two-tailed 1 percent test
Why: the z that leaves 0.005 in each tail.
\[ z^{*} = 2.576 \]
Convert the cutoff to a gap
Why: a gap is significant when it is at least z-star standard errors from zero.
\[ 2.576 \times 0.02713 \approx 0.0699 \]
Repeat at the 5 percent level
Why: the cutoff is 1.96.
\[ 1.96 \times 0.02713 \approx 0.0532 \]
So with 200 adults per medication, a gap had to reach about 7 percentage points to count at 1 percent, and about 5.3 points at 5 percent. The observed 4 points fell short of both. A study this size simply cannot distinguish a four-point difference from chance.
This is why the conclusion says not sufficient evidence rather than no difference. A real four-point advantage for medication B, which could matter to patients, would usually be missed by a study of this size.
Check by dividing back
Why: the critical gap over the standard error must return the cutoff.
\[ \frac{0.0699}{0.02713} \approx 2.576 \quad \checkmark \]
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, pp. 523-524 — Example 10.8, extended
Picture it
Is the pooled standard error right? Here is a check that uses no formula. The computer gave 200 simulated adults each medication, 3,000 times over, with both medications set to leave exactly 8 percent with hives: the null world, at the pooled value.
Figure (svg): A histogram of 3000 simulated differences in the proportion still with hives, each from 200 adults per medication with both true proportions equal to 0.08. The bars form a bell centred at zero; the normal curve with standard deviation 0.0271 runs along their tops. Bars at or beyond plus or minus 0.04 are yellow.
The simulated differences have standard deviation 0.0265, against the formula's 0.0271, and their average is -0.0010, essentially zero. The bars follow the normal curve closely, which is the book's claim that the difference is approximately normal.
Now count: 465 of the 3000 studies, a share of 0.155, gave a gap of 0.04 or more either way, and 334, a share of 0.111, gave a gap of more than 0.04. Differences of counts out of 200 come in steps of 0.005, so landing exactly on 0.04 is a real possibility, and the normal curve's 0.1404 sits between those two shares. With samples of 200 the normal approximation is close, not exact.
Error analysis
Here is an attempt at the hives standard error that drops one of the two reciprocal terms. It produces a believable-looking z, which is what makes the slip dangerous.
Annotate
On: \( SE = \sqrt{(0.08)(0.92)\left(\frac{1}{200}\right)} = 0.0192, \quad z = 2.09 \)
This slip is common because the one-sample formula from Chapter 9 is so familiar. The guard is the check from the worked example: a two-sample standard error at equal sizes is the one-sample error times the square root of two, about 41 percent larger. Comparing two groups is always noisier than measuring one.
Notice the cost here is not small. The wrong error turns a clear do-not-reject into a reject at 5 percent, a claim of a difference between medications that the data do not support.
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, p. 523 — the distribution for the differences
Comparison
Fill in the blanks to compare this section's standard error with the two you met for means. Every row turns on one question: what does the null hypothesis say about spread?
Comparison matrix
| 10.1: two means | 10.2: two means, σ known | 10.3: two proportions | |
|---|---|---|---|
| what H₀ fixes | μ₁ = μ₂ only | μ₁ = μ₂ only | p_A = p_B, and so the spreads |
| spreads in the SE | s₁, s₂ separately | σ₁, σ₂ as given | pooled |
| distribution | Student's t | normal | normal |
| degrees of freedom | Aspin-Welch | none | none |
| centre under H₀ | 0 | 0 | 0 |
Read the table by its second row. Section 10.1 had to estimate each spread from its own sample, which cost a t distribution and a degrees-of-freedom formula. Section 10.2 was handed the spreads. This section gets its spread from the null itself, through the pooled proportion, so like 10.2 it uses the normal curve.
The bottom row never changes: every two-sample test in the chapter centres the null curve at zero, the null's value for the difference.
Concept
Pooling is tied to the null hypothesis, so it belongs only where the null is assumed: computing a p-value. If instead you want a confidence interval for the size of the difference, there is no null in force, the two proportions are allowed to differ, and each sample keeps its own pq.
\[ SE_{\text{interval}} = \sqrt{\frac{p'_A q'_A}{n_A} + \frac{p'_B q'_B}{n_B}} \]
For Example 10.10 that unpooled standard error is about 0.0167, smaller than the pooled 0.0207, because the older sample's own proportion, 0.0517, is far from the pooled 0.0933. A 95 percent interval for the difference younger minus older is then the observed gap plus or minus 1.96 of those.
\[ 0.0488 \pm 1.96(0.0167) = 0.0488 \pm 0.0327 \Rightarrow (0.016, \; 0.082) \]
Read it in context: younger adults' ownership rate is plausibly between about 1.6 and 8.2 percentage points higher than older adults'. The interval excludes zero, agreeing with the test's rejection. Intervals for two proportions are not part of this section; the point here is only that pooling is a consequence of the null, so it goes wherever the null goes and nowhere else.
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, pp. 526-527 — Example 10.10, extended
Tweak it
The hives study saw a gap of 4 percentage points and could not call it significant. Keep the shares fixed at 10 and 6 percent and change only the number of adults per medication. The curve is the null distribution of the difference; the gap stays at 0.04.
Parameter explorer
The curve is the null distribution of the difference in proportions with pooled proportion 0.08 and n adults per medication. Slide n from 50 to 1,000 and find roughly the smallest n at which 0.04 lies out in the thin right tail.
\[ SE = \sqrt{0.0736 \cdot 2 / {n}} \]
What to notice: the observed gap never moves, but the curve narrows like one over the square root of n. The same four points go from ordinary to convincing as the samples grow.
| adults per medication | standard error | z | two-tailed p-value |
|---|---|---|---|
| 100 | 0.0384 | 1.04 | 0.2971 |
| 200 (the study) | 0.0271 | 1.47 | 0.1404 |
| 400 | 0.0192 | 2.09 | 0.0371 |
| 611 | 0.0155 | 2.58 | 0.0100 |
| 1,000 | 0.0121 | 3.30 | 0.0010 |
Figure (svg): A falling curve of the standard error of the difference in proportions against the number of adults per medication, from 50 to 1,000, with the pooled proportion fixed at 0.08. A dot at 200 marks 0.0271. A dashed line at 0.0155 marks the standard error at which a 0.04 gap reaches the 1 percent cutoff; the curve crosses it at about 611.
So a non-significant result from a small study is weak evidence of no difference. The hives study could not have detected a four-point gap at 1 percent unless it had been about three times larger.
Prediction
The valve study of Try It 10.8 asks whether there is a difference in the proportions that crack. Its statistic, as you will compute in Part 5, is about 2.08, and the area beyond 2.08 in the right tail alone is about 0.019. Before reading on, decide what the p-value is.
Predict first
For the valve test, with the alternative that the two cracking proportions are not equal and a right-tail area of 0.019 beyond the statistic, what is the p-value?
Correct: 0.038, the right-tail area doubled
Why: A claim of a difference counts a gap this large in either direction as evidence, so the p-value is the right tail plus its mirror image on the left: twice 0.019, about 0.038.
Forgetting to double is the commonest arithmetic slip in two-tailed tests, and it always flatters the evidence. Here it would not change the decision at 5 percent, since both 0.019 and 0.038 are below 0.05. In the hives study it would: the single tail there is 0.0702, which would reject at 10 percent, while the correct 0.1404 does not.
Read the tail off the alternative's sign every time, before you look at the statistic: not equal doubles one tail, greater than takes the right tail, less than takes the left.
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, p. 524 — half the p-value is below −0.04, and half is above 0.04
Section
Part 4
Concept
The book lists three characteristics a two-proportion test needs. Each one protects a different step of the reasoning you have just built.
The first protects the variance addition: variances add only for independent samples, so two groups chosen together, or the same people measured twice, break the standard error. Measuring the same people twice is a different test, matched pairs, in Section 10.4.
The second protects the normal curve. A count is approximately normal only when it is not squashed against zero or against n. Too few successes, or too few failures, and the sampling distribution is lopsided, so normal tail areas are wrong.
The third protects the independence of trials within a sample. Drawing without replacement from a small population changes the chances as you go; if the population is many times the sample, the effect is negligible.
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, p. 523 — the three characteristics
Picture it
The second condition has four parts: successes and failures in sample A, successes and failures in sample B. In this section's examples the outcome counted is uncommon, so the failures are large and the success counts are where trouble can live.
Figure (svg): Six horizontal bars of success counts with a dashed line at 5. Hives A 20, hives B 12, valves B 6, older adults owning electric vehicles 12, and men favouring tea 16 all pass the line in blue. A rare side effect seen in 3 of 150 patients falls short in red.
Every example from the book passes, some narrowly: the valve B sample had just 6 cracks. The last bar is a made-up case to show a failure, a side effect seen in 3 of 150 patients. With only three successes, the count of side effects cannot look normal, however many failures sit beside it.
Why five, and why both outcomes? The normal curve is symmetric, and a count piled up near zero, or near n, cannot be: it has a wall on one side. Five of each is the book's working threshold for when the wall is far enough away that the bell shape is a fair description.
When a count fails, the normal tail areas cannot be trusted, and an exact method is needed instead. That is beyond this course, but recognising the failure is not: a p-value from a failing count is a number with no meaning attached.
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, p. 523 — the number of successes is at least five, and the number of failures is at least five, for each of the samples
Worked example
Check the seat-belt study before trusting its z. Each line checks one condition with a reason, and the four counts get a line each because each one can fail on its own.
Independent random samples
Why: the data are a random sample of United States adults, and men and women are separate groups within it.
\[ \text{independent groups} \quad \checkmark \]
Independence has two parts. Within each sample, one adult's answer should not influence another's, which random sampling secures. Between the samples, no adult can appear in both, which holds because each adult is either a man or a woman in this survey.
Successes among women
Why: women not wearing seat belts.
\[ x_F = 156 \ge 5 \]
Failures among women
Why: women surveyed minus those without belts.
\[ 2169 - 156 = 2013 \ge 5 \]
Successes among men
Why: men not wearing seat belts.
\[ x_M = 183 \ge 5 \]
Failures among men
Why: the same subtraction for men.
\[ 2231 - 183 = 2048 \ge 5 \]
All four counts are in the hundreds or thousands, so the normal approximation is excellent here. The condition only bites when an outcome is rare or a sample is small.
Population size
Why: twenty times each sample is about 45,000 people, and there are tens of millions of adult men and adult women in the country.
\[ 20 \times 2231 = 44{,}620 \ll \text{adult men in the U.S.} \]
Check all three together
Why: random independent samples, four counts of at least five, populations far larger than twenty times the samples.
\[ \text{conditions met} \quad \checkmark \]
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, pp. 523, 525 — the characteristics, and Example 10.9
Discrimination
Each study below compares two proportions. Sort them by whether the two-proportion z test can be used as it stands. Check independence, the four counts and the population size in that order, and stop at the first failure.
Sort into buckets
Sort each study by whether the two-proportion test applies.
Two of the failures are easy to miss. In the inspection study the successes are huge, but the failures, 4 and 1, are the small counts, so the outcome that is rare is passing inspection's opposite. In the colleges study, 300 out of 900 is a third of each population, far more than one tenth.
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, p. 523 — the three characteristics
Real world
A coffee chain shows 80 customers an advert. Before it, 22 of them say they would buy a new drink; after it, 35 say so. The marketing team wants to run Example 10.8's test on 22 of 80 against 35 of 80.
Discussion prompt
Explain why the two-proportion test of this section is the wrong tool here, which condition fails, and what the failure does to the standard error.
Notice that every number in the proposal looks fine: 22 and 35 successes, 58 and 45 failures, all comfortably above five. The counts condition passes, which is exactly why the independence failure is easy to miss. Conditions are checked one by one, and passing three does not excuse the fourth.
The give-away is a single group of people appearing in both samples. Whenever the same individuals answer twice, ask about the changes, not about two separate shares.
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, p. 523 — the two independent samples are simple random samples that are independent
Section
Part 5
Concept
Every two-proportion test runs the same sequence. Each move answers one question, and each has a slide earlier in this deck.
The calculator's 2-PropZTest does moves five and six in one keystroke, and the book gives the keys for each example. The keystrokes cannot do moves one to four or seven, and those are where marks are lost.
\[ z = \frac{p'_A - p'_B}{\sqrt{p_c q_c \left(\frac{1}{n_A} + \frac{1}{n_B}\right)}}, \qquad p_c = \frac{x_A + x_B}{n_A + n_B} \]
These two lines are all the arithmetic there is. The remaining four Examples and Try Its run the whole sequence.
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, pp. 523-524 — the pooled proportion, the distribution and the test statistic
Worked example
Continue the seat-belt test from its set-up. Women minus men, 156 of 2,169 against 183 of 2,231; the observed difference was minus 0.0101.
Pool the counts
Why: successes are adults not wearing seat belts.
\[ p_c = \frac{156 + 183}{2169 + 2231} = \frac{339}{4400} \approx 0.07705 \]
Under the null about 7.7 percent of all adults skip seat belts, men and women alike. With equal-sized groups the pooled value is close to the midpoint of 7.2 and 8.2 percent, and here the groups are nearly equal, 2,169 against 2,231.
Multiply by the complement
Why: the pooled pq.
\[ (0.07705)(0.92295) \approx 0.07111 \]
Add the reciprocals
Why: keep enough decimals: these are small numbers.
\[ \frac{1}{2169} + \frac{1}{2231} \approx 0.00046104 + 0.00044823 = 0.00090927 \]
Multiply and take the root
Why: the standard error.
\[ SE = \sqrt{0.07111 \times 0.00090927} = \sqrt{0.00006466} \approx 0.008041 \]
The standard error is about eight tenths of a percentage point, small because the samples are large. Even so, the observed gap of about one point is not much bigger.
Divide the observed difference by the standard error
Why: the null's difference is 0.
\[ z = \frac{-0.01010}{0.008041} \approx -1.2565 \]
Check against the book's calculator output
Why: 2-PropZTest with 156, 2169, 183, 2231 and less than.
\[ z = -1.256 \quad \checkmark \]
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, pp. 525-526 — Example 10.9 and its calculator output
Worked example
The alternative says women's proportion is less than men's, with women first in the subtraction, so the p-value is the area to the left of the statistic.
Find the left-tail area
Why: the standard normal curve below z.
\[ p\text{-value} = P(Z < -1.2565) \approx 0.1045 \]
Figure (svg): A normal curve centred at 0 with standard deviation 0.00804 for the difference women minus men in the proportion not wearing seat belts, drawn from minus 0.03 to 0.03. A yellow line at minus 0.0101 marks the observed difference; the area to its left is shaded red, labelled p-value 0.1045. A dashed red line at minus 0.0187 marks the 1 percent cutoff.
Compare with alpha
Why: alpha was set at 1 percent.
\[ \alpha = 0.01 < 0.1045 \]
Decide
Why: the result is not rare enough.
\[ \text{do not reject } H_0 \]
Conclusion in context: at the 1 percent level of significance, from the sample data, there is not sufficient evidence to conclude that the proportion of women not wearing seat belts is less than the proportion of men not wearing seat belts.
The samples did lean the researcher's way, 7.2 percent against 8.2 percent. But a one-point gap is only one and a quarter standard errors, and roughly one study in ten would show at least that much with equal proportions. The test needs a gap of about 1.9 points to reject at 1 percent.
Check the cutoff gap
Why: the 1 percent one-tailed cutoff is 2.326 standard errors.
\[ 2.326 \times 0.008041 \approx 0.0187 > 0.0101 \quad \checkmark \]
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, p. 525 — Example 10.9: Figure 10.8, decision and conclusion
Picture it
Example 10.10 has one large sample and one small one. The pooled standard error splits into two pieces, one per sample, and the triangle shows how they combine.
\[ SE^2 = \frac{p_c q_c}{1343} + \frac{p_c q_c}{232} = 0.0000630 + 0.0003648 \]
Figure (svg): A right triangle. The short horizontal leg, 0.0079, is the standard error contributed by the 1,343 younger adults; the long vertical leg, 0.0191, is the standard error from the 232 older adults. The hypotenuse, 0.0207, is the standard error of the difference, only a little longer than the long leg.
The older adults are under a sixth of all the people, yet they contribute nearly six times as much variance as the younger ones. A standard error is limited by its smaller sample: adding more younger adults would barely help, while doubling the older sample would cut the error noticeably.
Check the arithmetic of the picture: square the two legs, 0.0079 and 0.0191, add them, and take the root. The squares are 0.0000630 and 0.0003648, their sum is 0.0004278, and its root is 0.0207, the hypotenuse. Adding the legs directly would give 0.0270, far too big.
This is worth knowing when you design a study. If one group is hard to recruit, the precision of the comparison is set by that group, and a huge sample from the easy group buys almost nothing.
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, pp. 526-527 — Example 10.10
Worked example
Continue the electric-vehicle test with the real counts, 135 of 1,343 younger and 12 of 232 older adults, and the pooled proportion 0.0933 from Part 2.
Multiply the pooled proportion by its complement
Why: the pooled pq.
\[ (0.09333)(0.90667) \approx 0.08462 \]
Add the reciprocals
Why: the small sample's term is nearly six times the large one's.
\[ \frac{1}{1343} + \frac{1}{232} \approx 0.000745 + 0.004310 = 0.005055 \]
This line is the triangle picture in numbers: the 232 older adults contribute 85 percent of the bracket. Whatever precision this comparison has is set by the older sample.
Multiply and take the root
Why: the standard error.
\[ SE = \sqrt{0.08462 \times 0.005055} = \sqrt{0.0004278} \approx 0.02068 \]
Find the observed difference
Why: younger minus older, as chosen for a right tail.
\[ p'_Y - p'_O = 0.10052 - 0.05172 = 0.04880 \]
Standardise
Why: divide by the standard error.
\[ z = \frac{0.04880}{0.02068} \approx 2.36 \]
The book's calculator line prints z equals 2.33 beside a p-value of 0.0092. Those two do not match: a z of 2.33 has right-tail area 0.0099, while 2.36 has 0.0092. The counts give 2.36, and the printed 2.33 is a misprint.
Check the statistic against the printed p-value
Why: the right-tail area at 2.36 should reproduce the calculator's 0.0092.
\[ P(Z > 2.3594) \approx 0.0092 \quad \checkmark \]
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, p. 527 — Example 10.10: calculator output P = 0.0092
Worked example
Finish the test at the 5 percent level, then settle why the book shows 0.0077 in one place and 0.0092 in another.
Find the right-tail area
Why: the alternative says younger is greater.
\[ p\text{-value} = P(Z > 2.36) \approx 0.0092 \]
Figure (svg): A normal curve centred at 0 with standard deviation 0.0207 for the difference younger minus older in the proportion owning electric vehicles, from minus 0.07 to 0.07. A dashed red line at 0.034 marks the 5 percent cutoff. A yellow line at 0.0488 marks the observed difference; the tiny area to its right is labelled p-value 0.0092.
Read the p-value in words before deciding: if younger and older adults owned electric vehicles at the same rate, fewer than one survey in a hundred of this design would show the younger group ahead by five points or more.
Compare with alpha and decide
Why: the result is rarer than one in twenty.
\[ 0.0092 < 0.05 \Rightarrow \text{reject } H_0 \]
Conclusion in context: at the 5 percent level, from the sample data, there is sufficient evidence to conclude that a larger proportion of younger adults than older adults own electric vehicles. The marketing firm's claim is supported.
Redo with the rounded shares
Why: the book's 0.0077 uses 0.10 and 0.05, a difference of exactly 0.05.
\[ z = \frac{0.05}{0.02061} \approx 2.43, \quad p \approx 0.0076 \]
So both printed p-values are honest calculations: one from rounded percentages, one from the real counts. The counts are better, because rounding 5.17 percent down to 5 inflated the gap. Use counts whenever they exist.
Check the decision is the same either way
Why: both p-values are far below alpha.
\[ 0.0076 < 0.05, \quad 0.0092 < 0.05 \quad \checkmark \]
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, p. 527 — Example 10.10: p-value 0.0077 and the calculator's 0.0092
Concept
The book ends every test with a sentence in the same shape. Learning the shape saves marks, because each of its parts answers a question a reader will ask: how strict were you, what was the evidence, and what exactly do you now believe about the populations?
\[ \text{At the } \alpha \text{ level, from the sample data,} \]
\[ \text{there } \textbf{is / is not} \text{ sufficient evidence that } [H_a \text{ in words}] \]
The level comes first because the same data can reject at 5 percent and fail at 1 percent, as the valves will show. The phrase from the sample data reminds the reader that the claim rests on two samples, not on the whole populations.
Then the alternative, translated back into the language of the problem: the proportion of women not wearing seat belts is less than the proportion of men, not p-F is less than p-M. If a reader needs to know what F means, the sentence has failed.
Notice that both versions talk about the alternative. A test never produces evidence for the null; it either finds enough evidence against it or does not. That asymmetry is the reason non-rejection is never acceptance.
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, pp. 524-527 — the conclusions of Examples 10.8 to 10.10
Worked example
Fifteen of 100 type A valves and six of 100 type B valves cracked under 4,500 psi. Is there a difference in the proportions that crack? Test at the 5 percent level. The pooled values come from the fill-in slide.
Write the hypotheses
Why: a difference, so two-tailed.
\[ H_0: p_A = p_B, \qquad H_a: p_A \ne p_B \]
Check the four counts
Why: cracked and did not crack, in each sample.
\[ 15, \; 85, \; 6, \; 94 \quad \text{all} \ge 5 \]
Build the standard error
Why: pooled 0.105, two samples of 100.
\[ SE = \sqrt{0.093975 \times 0.02} = \sqrt{0.0018795} \approx 0.04335 \]
Standardise the observed difference
Why: 0.15 minus 0.06.
\[ z = \frac{0.09}{0.04335} \approx 2.076 \]
The gap here is nine percentage points, more than twice the hives gap, but the samples are half the size, so the standard error is larger too. The statistic ends up just past two, which is borderline territory: the decision will depend on the level chosen.
Find the two-tailed p-value
Why: double the right tail.
\[ p = 2 \times P(Z > 2.076) = 2 \times 0.0189 \approx 0.0379 \]
Figure (svg): A standard normal curve from minus 3.5 to 3.5. Dashed red lines at plus and minus 1.96 bound the 5 percent rejection region. A yellow line marks z equals 2.08, just past 1.96. Both tails beyond 2.08 are shaded, each 0.019.
Decide
Why: below the 5 percent level, narrowly.
\[ 0.0379 < 0.05 \Rightarrow \text{reject } H_0 \]
Conclusion: at the 5 percent level there is sufficient evidence of a difference in the proportions of type A and type B valves that crack under 4,500 psi; in the samples, type A cracked more often. At the 1 percent level this would not reject.
Check with the critical value
Why: the two-tailed 5 percent cutoff is 1.96.
\[ 2.076 > 1.96 \iff 0.0379 < 0.05 \quad \checkmark \]
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, p. 524 — Try It 10.8
Worked example
Sixteen of 230 men and 18 of 218 women favour tea. Is the proportion of men favouring tea more than the proportion of women? Test at the 1 percent level.
Write the hypotheses
Why: men minus women; more than gives a right tail.
\[ H_0: p_M = p_W, \qquad H_a: p_M > p_W \]
Compute the sample proportions
Why: each count over its own total.
\[ p'_M = \frac{16}{230} \approx 0.0696, \qquad p'_W = \frac{18}{218} \approx 0.0826 \]
Already the answer is visible: the men's sample proportion is smaller, the opposite of the claim. A right-tailed test cannot find evidence for more in data that show less.
Pool and build the standard error
Why: 34 of 448.
\[ p_c = \frac{34}{448} \approx 0.0759, \quad SE = \sqrt{0.07013 \times 0.008935} \approx 0.02503 \]
Standardise
Why: the observed difference is negative.
\[ z = \frac{0.0696 - 0.0826}{0.02503} = \frac{-0.0130}{0.02503} \approx -0.52 \]
Find the right-tail area
Why: everything above the statistic.
\[ p = P(Z > -0.52) \approx 0.698 \]
Do not be tempted to switch to the left tail because that is where the data went. The tail was fixed by the claim before the data were seen; choosing it afterwards would let any result look significant in some direction.
Figure (svg): A normal curve centred at 0 with standard deviation 0.0250 for men minus women in the proportion favouring tea, from minus 0.08 to 0.08. A yellow line at minus 0.013 marks the observed difference, on the left of centre. Everything to its right, about 70 percent of the curve, is shaded and labelled p-value 0.698.
Conclusion: at the 1 percent level there is not sufficient evidence that the proportion of men favouring tea is more than the proportion of women. In fact the sample leaned the other way.
Check the p-value's size makes sense
Why: a statistic on the wrong side of zero must give a one-tailed p-value above one half.
\[ z < 0 \Rightarrow P(Z > z) > 0.5: \quad 0.698 > 0.5 \quad \checkmark \]
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, p. 526 — Try It 10.9 and Table 10.13
Step zero
Try It 10.10 asks about motorcycle helmets in two regions where helmets are required by law. In the northeast, 7,622 of 113,231 motorcyclists did not wear helmets; in the southeast, 7,439 of 104,873 did not. Test at the 5 percent level. The book's first five parts ask nothing numerical.
Discussion prompt
Answer parts a to e: is this two means or two proportions, which distribution, what is the random variable, what are the hypotheses, and which tail?
Choose the order of subtraction now and say it out loud: northeast minus southeast. Nothing in the question favours one region, so either order is fine, but the sign of every later number depends on this choice.
These parts carry most of the reasoning, which is why the book asks them separately. Get them right and the remaining parts are the two formulas and a sentence; get the tail wrong and every later number is wrong with it.
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, p. 527 — Try It 10.10, parts a to e
Worked example
Finish the helmet test. The counts are huge, so keep many decimals in the small quantities.
Compute the sample proportions
Why: each count over its own total.
\[ p'_{NE} = \frac{7622}{113231} \approx 0.06731, \quad p'_{SE} = \frac{7439}{104873} \approx 0.07093 \]
Pool the counts
Why: all riders without helmets over all riders.
\[ p_c = \frac{15061}{218104} \approx 0.06905, \quad p_c q_c \approx 0.06429 \]
Build the standard error
Why: the reciprocals are tiny.
\[ SE = \sqrt{0.06429 \times 0.000018367} \approx 0.0010866 \]
The conditions hold easily on counts: thousands of successes and failures in each region. The population condition deserves a question, though. Over a hundred thousand riders may be most of a region's motorcyclists rather than a small sample of them; the book does not say, and an honest report would.
Standardise
Why: northeast minus southeast.
\[ z = \frac{-0.003620}{0.0010866} \approx -3.33 \]
Find the two-tailed p-value
Why: double the left tail: part f.
\[ p = 2 \times P(Z < -3.33) \approx 0.00086 \]
Figure (svg): A normal curve centred at 0 with standard deviation 0.00109 for northeast minus southeast in the proportion not wearing helmets, from minus 0.0045 to 0.0045. A yellow line at minus 0.0036 marks the observed difference, far in the left tail; dashed red lines at plus and minus 0.0021 mark the 5 percent cutoffs.
Decide: part g
Why: far below alpha.
\[ 0.00086 < 0.05 \Rightarrow \text{reject } H_0 \]
Part h: at the 5 percent level of significance, from the sample data, there is sufficient evidence to conclude that the proportions of motorcyclists not wearing helmets differ between the northeast and the southeast.
Check the size of the effect
Why: significant is not the same as large: the gap is a third of a percentage point.
\[ 0.07093 - 0.06731 = 0.0036 \approx 0.36 \text{ points} \]
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, p. 527 — Try It 10.10, parts f to h
Trap
A report on the helmet study reads:
\[ p = 0.00086 \]
so the southeast has a dramatically worse helmet problem.
Wrong. A tiny p-value measures how sure, not how much.
Look at the size of the gap, not only its p-value:
\[ 6.73\% \text{ against } 7.09\% \]
\[ \text{gap} = 0.36 \text{ points} \]
With over two hundred thousand riders, the test can detect a third of a percentage point. Whether that matters for road safety is a judgement about the context; the p-value only says the gap is very unlikely to be chance. Report both: the difference and how sure you are of it.
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, p. 527 — Try It 10.10
Ranking
Six tests from this section, each with its own statistic. Strength of evidence against the null is measured by how small the p-value is, which for a fixed tail means how far out the statistic sits in the direction the alternative names.
Put in order
Order the tests from strongest evidence against the null to weakest.
Why: The p-values are 0.0009, 0.0092, 0.0379, 0.1045, 0.1404 and 0.698. The seat belts beat the hives despite a smaller statistic, because the belt test is one-tailed and the hives test doubles its tail. The tea test is last: its statistic points away from its alternative.
Two lessons hide in the order. A one-tailed test with a smaller statistic can beat a two-tailed test with a larger one, since doubling the tail costs evidence. And a statistic pointing the wrong way for its alternative gives a p-value above one half, the weakest evidence there can be.
Only the first three reject at 5 percent; only the first two would at 1 percent. And notice that the strongest evidence comes from the smallest effect: the helmet gap is a third of a point, the hives gap four points. The p-value reflects sample size as much as effect size, which is why a strength-of-evidence ranking is not a ranking of how much the groups differ.
Matching
The tail is set by the words of the claim and the order of subtraction, never by the data. Match each claim, with the subtraction order given, to the alternative it produces.
Match the pairs
Why: A claim of a difference gives two tails. A claim that one group is smaller gives a negative difference when that group is subtracted from first. The same electric-vehicle claim is a right tail written younger minus older and a left tail written older minus younger.
Read each claim for two things: the direction word, and which group is subtracted from which. Differ has no direction and gives two tails. Fewer and more have a direction, and that direction becomes a sign once you know the order of subtraction.
The last two rows are the same claim. Reversing the subtraction flips the sign of the statistic and the direction of the alternative together, so the p-value comes out identical. That is why the order is a free choice, as long as it is the same choice everywhere.
Section
Part 6
Pattern
Every test in this section followed the same template. Here it is with the reason for each move beside it, so you can rebuild it rather than memorise it.
| move | what you write | why |
|---|---|---|
| recognise | two independent samples, yes/no outcomes | decides proportions, not means or pairs |
| order | P′A − P′B | fixes the sign of z and the tail |
| hypotheses | H₀: pA = pB; Hₐ: ≠, > or < | the claim goes in Hₐ |
| conditions | random, independent; 4 counts ≥ 5; N ≥ 10–20n | variance addition and the normal curve |
| pool | p_c = (xA + xB)/(nA + nB) | under H₀ there is one proportion |
| standard error | √(p_c q_c (1/nA + 1/nB)) | variances add; pq shared |
| statistic | z = (p′A − p′B)/SE | gaps in standard errors |
| p-value | tail(s) from Hₐ | ≠ doubles one tail |
| conclude | sufficient / not sufficient evidence that … | about the populations, in context |
The single most important line is the pool, and its reason. If you remember only that the null of equal proportions forces equal spreads, you can rederive why the standard error looks the way it does, and why Section 10.1 did something different.
And the last line is the one marked most often: a conclusion names the populations and the outcome, uses the words sufficient evidence, and never says the null was proved or accepted.
Check
Pool counts, not percentages, and weight by size.
Here the samples are unequal, so the plain average of the two shares will not do. Turn each share back into a count if needed, then divide total successes by total trials.
Check your understanding
In one clinic 30 of 150 patients improved; in another 18 of 50 improved. What is the pooled proportion for a test that the two clinics' improvement rates are equal?
Answer: A
Why: Pool the counts: 30 plus 18 is 48 successes, and 150 plus 50 is 200 trials, so the pooled proportion is 48 over 200, which is 0.24. It sits nearer the larger clinic's 0.20 than the smaller clinic's 0.36.
In context: if the clinics are equally effective, the best estimate of their common improvement rate is 24 percent. The standard error would then be the square root of 0.24 times 0.76 times one over 150 plus one over 50, about 0.0697.
A quick check on any pooled answer: it must lie between the two sample proportions, here 0.20 and 0.36, and nearer the bigger sample.
Check
Think about what each null hypothesis says about spread.
The question is about the reason, not the formula. The right answer explains why the pooling instruction reverses between Section 10.1 and this one.
Check your understanding
Why does a test of two proportions pool the samples for its standard error, when a test of two means in Section 10.1 keeps the two spreads separate?
Answer: A
Why: The spread of a yes-or-no outcome is the square root of p times q, fixed by p. A null of equal proportions therefore also says the spreads are equal, so one pooled estimate is right. Two means can be equal while their standard deviations differ, so the null does not justify pooling there.
In context: for the hives study, saying the two medications leave the same share of adults with hives automatically says both shares have the same variability. For two floor waxes with the same average lifetime, one could still be far more erratic than the other.
If you can say that reason in one sentence, you understand the section's central idea, and you can tell which way to go on any new two-sample problem.
Check
Judge each option by what a test can and cannot say.
A decision is about the null; a conclusion is about the populations in the words of the problem, and a non-rejection is never proof of equality.
Check your understanding
A test of whether two schools have the same proportion of students who walk to school, at the 5 percent level, gives a p-value of 0.31. Which conclusion is correct?
Answer: A
Why: The p-value is above the significance level, so the null is not rejected. The conclusion then says only that the evidence is not sufficient to claim a difference, in the words of the problem, without claiming that the proportions are proven equal.
In context: the walking rates at the two schools may well differ, but these samples cannot show it at the 5 percent level. A larger survey might.
Each wrong option is a misreading you have met in this deck: acceptance in place of non-rejection, the p-value read as a probability about the hypothesis, and the decision rule backwards.
Explain it to yourself
The hives study saw 10 percent still reacting on medication A against 6 percent on medication B, and did not reject. A pharmacist asks whether that means the two medications work equally well. Answering without jargon is the best test of whether the section has landed.
Discussion prompt
In three or four plain sentences, tell the pharmacist what the study found, why it does not show a difference, and why it also does not show the medications are the same. Avoid the words null, alpha and p-value.
A strong answer names the evidence, four points out of 200 per group, says why it is not convincing, about one study in seven would show it by chance, and says what the study cannot rule out. A very strong one adds that the pharmacist's real question needs a bigger study.
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, pp. 523-524 — Example 10.8
Exit ticket
A new exercise in the same shape as the section. Hospital A recorded 24 infections in a random sample of 400 surgeries; hospital B recorded 15 in a random sample of 500. Test at the 5 percent level whether hospital A's infection rate is higher.
Discussion prompt
Check the four counts, write the hypotheses, pool, compute the standard error, z and p-value, and state the decision and the conclusion in context.
If you got about 0.045 for the pooled proportion, you averaged the two rates instead of pooling 39 of 900. If your p-value was about 0.028, you doubled a one-tailed test: the word higher makes this right-tailed only.
And notice what the conclusion does not say: it does not say why the rates differ. The samples are random, but hospitals are not randomly assigned their patients, so a difference in case mix could explain the gap as well as a difference in care.
Recap
Comparing two population proportions follows the same plan as comparing two means, with one genuinely new step: because the null says the two proportions are equal, the two samples are pooled into one estimate of that common proportion, and the standard error is built from it.
| idea | formula or rule | read it as |
|---|---|---|
| random variable | P′A − P′B | keep one order everywhere |
| hypotheses | H₀: pA = pB; Hₐ from the claim | about populations, never samples |
| pooled proportion | p_c = (xA + xB)/(nA + nB) | counts over trials, weighted by size |
| standard error | √(p_c q_c (1/nA + 1/nB)) | variances add; the small sample dominates |
| statistic | z = (p′A − p′B)/SE | normal, no degrees of freedom |
| conditions | random, independent; 4 counts ≥ 5; N ≥ 10–20n | check each count separately |
| conclusion | sufficient / not sufficient evidence that … | how sure, not how big |
The reason for pooling is the idea to keep: a proportion's spread is fixed by the proportion, so a null of equal proportions is also a null of equal spreads. A null of equal means fixes no spreads, which is why Section 10.1 kept them separate.
Corrections made in this deck: in Example 10.10 the percentages 10 and 5 are rounded, the real counts are 135 and 12, and the calculator's z is 2.36, not the printed 2.33; the printed 0.0077 comes from the rounded shares and the 0.0092 from the counts. The Business Statistics text works the same test in business settings in its Section 10.4.
OpenStax Introductory Statistics 2e, §10.3 Comparing Two Independent Population Proportions §10.3, pp. 523-527 — the whole section
OpenStax Introductory Business Statistics 2e, §10.4 Comparing Two Independent Population Proportions §10.4 Comparing Two Independent Population Proportions — the same test in business contexts
Want this taught 1-on-1? Alexander tutors Statistics — $55/session, free consultation.