With the setup done, carrying out a two-sample z test takes three more moves: compute the test statistic, find the p-value, and write the conclusion. Each move follows from one idea: we act as if the null hypothesis were true and ask how surprising the data would be.
The test statistic
Every standardized test statistic in this course has the same form:
For two proportions the statistic is and the null value is 0. If is true, both groups share one proportion, estimated by , so the standard error uses for both groups:
The denominator is the same as : the variances still add, but each one uses the pooled proportion. This formula is on the reference sheet.
The p-value
The p-value is the probability, assuming , of a difference at least as extreme as the one observed. Use the standard normal distribution and the direction of :
- : the area to the right of .
- : the area to the left of .
- : the area beyond in both tails, twice one tail.
Worked example 1 (one-sided). The city randomly assigned 160 households a new recycling bin and 140 the old bin; 125 and 91 sorted correctly. Test at whether the new bin increases correct sorting.
State. , , where and are the true proportions of households like these that would sort correctly with the new and the old bin.
Plan. A two-sample z test for . Random: the bins were randomly assigned. Large counts with : , , and are each at least 10.
Do.
On a calculator this is a 2-proportion z test with the counts and the alternative ; it reports the same and p-value.
Conclude. Because the p-value of 0.0058 is less than , we reject . There is convincing evidence that the true proportion of households like these that sort their recycling correctly is greater with the new bin than with the old bin. Because the bins were randomly assigned, the new bin can be credited with the improvement, for households like these volunteers.
The figure shows why the p-value is so small: if the bin made no difference, a gap of 0.131 would be more than 2.5 standard errors from 0.
Worked example 2 (two-sided). Independent random samples of 150 residents find 45 in Lakeview and 63 in Hillcrest who take transit to work. Is there convincing evidence that the true proportions differ, at ?
Because 0.030 is less than 0.05, we reject . There is convincing evidence that the true proportion of residents who take transit to work is different in Lakeview and Hillcrest.
Reading a p-value and a conclusion
Interpret a p-value with its condition first: "Assuming the true proportions are equal, there is a 0.0058 probability of getting a difference in sample proportions of 0.131 or more by chance." It is never the probability that is true.
When the p-value is large, say "fail to reject " and "there is not convincing evidence that ...". Never write "accept " or "the proportions are the same": the data are consistent with no difference, but a real difference may be too small for these samples to detect.
Errors and scope
| Decision | Possible error | In the recycling study |
|---|---|---|
| Reject | Type I | concluding the new bin helps when it truly makes no difference |
| Fail to reject | Type II | missing a real improvement from the new bin |
Random assignment allows a cause-and-effect conclusion; random samples allow generalizing to the populations sampled. A study needs the matching design for each kind of conclusion. A voluntary response sample, such as people who choose to vote on a website, supports neither, however small its p-value.