AP Statistics · Lesson 3

Two proportions and chi-square tests

Know Know it

To compare two proportions, the parameter is p1−p2p_1 - p_2. A confidence interval is (p^1−p^2)±z∗p^1(1−p^1)n1+p^2(1−p^2)n2(\hat{p}_1 - \hat{p}_2) \pm z^* \sqrt{\frac{\hat{p}_1(1-\hat{p}_1)}{n_1} + \frac{\hat{p}_2(1-\hat{p}_2)}{n_2}}. If the interval contains 0, the data do not give convincing evidence of a difference.

A test of H0:p1−p2=0H_0: p_1 - p_2 = 0 uses the pooled proportion p^c=x1+x2n1+n2\hat{p}_c = \frac{x_1 + x_2}{n_1 + n_2}, because the null says the two proportions are equal: z=p^1−p^2p^c(1−p^c)(1n1+1n2)z = \frac{\hat{p}_1 - \hat{p}_2}{\sqrt{\hat{p}_c(1-\hat{p}_c)\left(\frac{1}{n_1} + \frac{1}{n_2}\right)}}.

Conditions for two proportions: two independent random samples or two groups formed by random assignment; the 10 percent condition for each sample taken without replacement; and at least 10 successes and 10 failures in each group (for a test, check that n1p^cn_1\hat{p}_c, n1(1−p^c)n_1(1-\hat{p}_c), n2p^cn_2\hat{p}_c and n2(1−p^c)n_2(1-\hat{p}_c) are all at least 10).

A chi-square test works on a two-way table of counts. Use a test for homogeneity when separate samples or treatment groups are compared on one categorical variable. Use a test for independence when one sample is classified by two categorical variables.

The expected count of a cell is row total⋅column totalgrand total\frac{\text{row total} \cdot \text{column total}}{\text{grand total}}. Then χ2=∑(observed−expected)2expected\chi^2 = \sum \frac{(\text{observed} - \text{expected})^2}{\text{expected}} with (r−1)(c−1)(r-1)(c-1) degrees of freedom. The conditions are random samples or random assignment, the 10 percent condition, and every expected count at least 5. A large χ2\chi^2 gives a small P-value, and the cells with the largest contributions show where the difference is.

Worked example Easy

Lunch choice for random samples of 10th and 12th graders at a fictional school

GradeSchool lunchPacked lunchFood truckTotal
10th704070180
12th405030120
Total11090100300

If lunch choice had the same distribution in both grades, what would be the expected count of 10th graders who choose school lunch?

  1. 70
  2. 55
  3. 66Answer
  4. 60

How to solve it

  1. The cell is in the 10th-grade row (total 180) and the school-lunch column (total 110).
  2. Expected count =180⋅110300=66= \frac{180 \cdot 110}{300} = 66.
  3. This matches the idea that if the distributions were the same, 110/300, about 36.7 percent, of each grade would choose school lunch.

Why each choice is right or wrong

  • A. Incorrect. 70 is the observed count of 10th graders who choose school lunch, not the count expected under the null.
  • B. Incorrect. 55 splits the 110 school-lunch students evenly between the grades, but the grades have different sample sizes.
  • C. Correct. The expected count is row total times column total over the grand total: 180⋅110300=66\frac{180 \cdot 110}{300} = 66.
  • D. Incorrect. 60 splits the 180 10th graders evenly across the three choices, which ignores how popular each choice is overall.

Trap Chi-square uses counts, not percents

Put counts into the chi-square formula, never percents or proportions: the same percents from a bigger sample are stronger evidence, and only counts show that. Check that every expected count, not every observed count, is at least 5.

Explain Explain it

Task verbs: calculate, interpret

For a two-proportion interval, say which group is subtracted from which, then interpret it like any interval: "We are 95 percent confident that the interval captures the true difference (group 1 minus group 2)." If both endpoints are positive, there is convincing evidence that group 1's proportion is higher; if the interval contains 0, no difference has been shown.

For a chi-square test, finish the same way as any test: compare the P-value with α\alpha and state the conclusion about the populations in context, naming the variable that does or does not differ.

Worked example Medium

A fictional school took a random sample of 180 10th graders and a separate random sample of 120 12th graders and recorded each student's lunch choice: 10th graders chose school lunch 70 times, packed lunch 40 times and the food truck 70 times; 12th graders chose them 40, 50 and 30 times. A chi-square test for homogeneity is run.

Which gives the chi-square statistic, the degrees of freedom and the P-value?

  1. χ2≈13.85\chi^2 \approx 13.85, 5 degrees of freedom, P-value about 0.017
  2. χ2≈14.21\chi^2 \approx 14.21, 2 degrees of freedom, P-value about 0.0008
  3. χ2≈13.85\chi^2 \approx 13.85, 6 degrees of freedom, P-value about 0.031
  4. χ2≈13.85\chi^2 \approx 13.85, 2 degrees of freedom, P-value about 0.001Answer

How to solve it

  1. Expected counts: 10th grade 66, 54, 60; 12th grade 44, 36, 40. All are at least 5.
  2. Contributions: 0.24, 3.63, 1.67 for 10th grade and 0.36, 5.44, 2.50 for 12th grade, which add to about 13.85.
  3. Degrees of freedom: (2−1)(3−1)=2(2 - 1)(3 - 1) = 2, and P(χ22>13.85)≈0.001P(\chi^2_2 > 13.85) \approx 0.001.

Why each choice is right or wrong

  • A. Incorrect. 5 degrees of freedom is the number of cells minus 1, but a two-way table uses (2 - 1)(3 - 1) = 2.
  • B. Incorrect. 14.21 divides each squared difference by the observed count; the chi-square statistic divides by the expected count.
  • C. Incorrect. 6 degrees of freedom counts all six cells, but the degrees of freedom are (rows - 1)(columns - 1) = 2.
  • D. Correct. The expected counts are 66, 54 and 60 for 10th graders and 44, 36 and 40 for 12th graders, the sum of the six contributions is about 13.85, and with 2 degrees of freedom the P-value is about 0.001.

Interpret Your turn

A fictional library randomly assigned 500 members to get due-date reminders by text message (250 members) or by email (250 members). Of the text group, 82 percent returned their books on time; of the email group, 74 percent did. A 95 percent confidence interval for p-text minus p-email is 0.008 to 0.152. Interpret the interval in context, and say whether it gives convincing evidence that text reminders work better.

Write it, then compare. Nothing you type here is saved or graded.

Compare with a model answer

A full answer does this

  • Interprets the interval as capturing the true difference in on-time return rates, text minus email, with 95 percent confidence
  • Concludes that text reminders work better because every value in the interval is above 0

Model answer

We are 95 percent confident that the interval from 0.008 to 0.152 captures the true difference in the proportion of members who would return their books on time with text reminders minus the proportion who would with email reminders. Every value in the interval is above 0, so the interval gives convincing evidence that text reminders lead to a higher on-time return rate than email reminders.

Apply Apply it

Practice these topics. AP Practice questions on exactly what this lesson covers, with an explanation for every answer.