Lesson 6.4 · Inference for Proportions
Inference for two proportions
Many of the most interesting questions in statistics are comparisons. Does a new reminder text raise vaccination rates compared with the old one? Are seniors more likely than juniors to have a job? To answer questions like these, you estimate and test the difference between two population proportions, .
The sampling distribution of a difference
Suppose you take independent random samples from two populations (or randomly assign subjects to two treatments). The natural statistic is . From Unit 5, its sampling distribution has:
- center (so is unbiased),
- standard deviation (variances add, standard deviations do not),
- approximately Normal shape when all four expected counts are at least 10.
Everything in this lesson builds on those three facts.
Conditions
- Random: two independent random samples, or two groups formed by random assignment in an experiment.
- 10%: when sampling without replacement, and . (Not needed for a randomized experiment that does not sample from a population.)
- Large Counts: at least 10 successes and 10 failures in each group. For an interval, use the observed counts , , , . For a test, use the pooled proportion (defined below).
Confidence interval for
Two-sample z-interval for a difference in proportions
The critical values are the same as before: for 90%, for 95%, and for 99%.
The most important question to ask of a two-proportion interval is whether it contains 0. If every value in the interval is positive, you have convincing evidence that . If every value is negative, . If the interval contains 0, "no difference" is plausible.
Worked example: A 95% interval for a difference
A researcher randomly selects 150 students from a large urban district and 160 from a large rural district. In the urban sample, 45 students walk or bike to school; in the rural sample, 30 do. Construct and interpret a 95% confidence interval for the difference in the proportions of all students who walk or bike (urban minus rural).
State: Estimate , where and are the proportions of all students in the urban and rural districts who walk or bike to school, with 95% confidence.
Plan: Two-sample -interval for .
- Random: independent random samples from each district.
- 10%: 150 and 160 are each less than 10% of the students in a large district.
- Large Counts: are all at least 10.
Do: and .
Conclude: We are 95% confident that the interval from 0.017 to 0.208 captures the true difference in proportions (urban minus rural) of students who walk or bike to school. Because the entire interval is above 0, there is convincing evidence that a higher proportion of urban students walk or bike.
Significance test for
The null hypothesis is almost always "no difference": , which is the same as . The alternative can be , , or .
If is true, the two populations share one common proportion. Your best estimate of it combines both samples into a pooled (combined) proportion:
Two-sample z-test for a difference in proportions
Check Large Counts with , , , .
Common mistake
Use the pooled proportion only for a test, where says the proportions are equal. For a confidence interval, you are not assuming they are equal, so use the separate and in the standard error. Mixing these up is the most common error on this topic.
Worked example: A test in a randomized experiment
A clinic randomly assigns 400 patients who are due for a checkup to receive one of two reminder messages. Of the 210 who got a personalized text, 63 booked an appointment within a week. Of the 190 who got a standard text, 42 booked. Is there convincing evidence at that the personalized text leads to a higher booking rate?
State: and , where and are the true proportions of patients like these who would book within a week after a personalized or a standard text. .
Plan: Two-sample -test for .
- Random: patients were randomly assigned to the two messages.
- 10%: not needed, since this is an experiment rather than a sample from a population.
- Large Counts: . The expected counts , , , and are all at least 10.
Do: and .
P-value .
Conclude: Because , reject . There is convincing evidence that the personalized text causes a higher booking rate than the standard text for patients like these. A causal conclusion is justified because the treatments were randomly assigned.
Scope of inference
What you can conclude depends on how the data were produced:
- Random assignment lets you conclude that a difference was caused by the treatment.
- Random sampling lets you generalize to the populations sampled.
In the reminder study, the patients were not a random sample of all patients everywhere, so the conclusion applies to patients like those in the study. In the walking example, the students were randomly sampled but not assigned to districts, so you can generalize to each district but cannot say that living in a city causes more walking.
Tip
Always define which group is "1" and which is "2" and keep the order consistent. If you subtract in the other order, the interval flips sign, for example , and a one-sided alternative flips direction. Either order is fine as long as your conclusion matches.
Practice
A researcher wants to test whether the proportion of adults who own an electric vehicle differs between two states. Which formula should she use for the standard deviation in her test statistic?
In a random sample of 200 seniors at a large high school, 84 have a part-time job. In an independent random sample of 220 juniors at the same school, 66 have a part-time job. Assume the conditions are met. Find a 95% confidence interval for , the difference in the proportions of all seniors and all juniors with a part-time job. Give both endpoints, rounded to three decimal places.
Separate answers with commas, e.g. 2, -5
Based on the interval from the previous problem, which conclusion is best?
A company randomly assigns 800 website visitors to see one of two checkout pages. Of 400 who saw page A, 156 completed a purchase. Of 400 who saw page B, 124 completed a purchase. Find the pooled proportion for testing whether the purchase rates differ.
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
Continuing the checkout experiment, compute the test statistic for versus . Round to two decimal places.
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
Using and the two-sided alternative , find the P-value. Round to four decimal places.
Enter a number. Fractions like 3/4 and sqrt(2) are OK.
For the checkout experiment (P-value ), which conclusion is correct at ?
A 99% confidence interval for , the difference in the proportions of left-handed people in two large countries, is . Which statement is correct?