AP Statistics · Topic 3.15 · Reading guide, about 5 min

Expected counts, chi-square statistic and conclusions

Compute expected counts, the chi-square statistic, degrees of freedom and a p-value, then write a conclusion in context.

In one minute

Once you have chosen a chi-square test and checked that the setup makes sense, the work is a sequence of calculations and a carefully worded conclusion. Every cell needs an expected count, the statistic combines the gaps, and the p-value tells you how surprising the table is.

This topic finishes the test from 3.14. Computation is routine; the credit usually lies in the formulas shown, the conditions, and the conclusion in the right words.

Key terms

Expected count
For each cell, (row total times column total) divided by table total. It is the count H0H_0 predicts.
Chi-square statistic
χ2=∑(observed−expected)2expected\chi^2=\sum\dfrac{(\text{observed}-\text{expected})^2}{\text{expected}}, summed over every cell in the table.
Degrees of freedom
(rows−1)(columns−1)(\text{rows}-1)(\text{columns}-1), the number of cells you can fill freely once the totals are fixed.
Chi-square p-value
The probability, assuming H0H_0 is true, of a χ2\chi^2 at least as large as observed. It is the area in the right tail.
Cell contribution
One cell's term in the sum. Large contributions show where the table differs most from H0H_0.
Row total
The sum of all observed counts in one row of the table.
Column total
The sum of all observed counts in one column of the table.
Decision rule
Reject H0H_0 when the p-value is at most α\alpha; fail to reject when it is above α\alpha.

Expected counts

If H0H_0 is true, the response distribution is the same in every row or group, so each cell's share of its row matches the overall column share. That gives expected count =(row total)(column total)table total=\dfrac{(\text{row total})(\text{column total})}{\text{table total}}.

The same formula serves homogeneity and independence. Expected counts need not be whole numbers, and each row and column of expected counts adds to the same totals as the observed table, a handy check on your arithmetic.

The statistic, degrees of freedom and p-value

Compute (observed−expected)2/expected(\text{observed}-\text{expected})^2/\text{expected} in every cell and add them. With rr rows and cc columns, the degrees of freedom are (r−1)(c−1)(r-1)(c-1). A table with 2 rows and 3 columns has 2 degrees of freedom.

The p-value comes from a chi-square table or technology, always in the upper tail. For 2 degrees of freedom a simple formula exists, e−χ2/2e^{-\chi^2/2}, which is useful for checking output, but you will normally use technology for other degrees of freedom.

State the p-value's meaning: assuming H0H_0 is true, it is the probability of getting a chi-square value at least as large as the one observed, from samples like these.

The chi-square test in four steps
StepWhat to show
StateTest name, hypotheses in words, in context, and alpha
PlanRandomization, 10% condition if sampling, and all expected counts at least 5
DoExpected counts, chi-square statistic, degrees of freedom, and p-value
ConcludeCompare p-value with alpha; state the conclusion about Ha in context

Worked example: independence

A school takes one random sample of 200 students and records each student's grade group (9-10 or 11-12) and how they get to school (invented data); it happens that 100 students fall in each grade group. Grades 9-10: bus 40, car 20, walk 40. Grades 11-12: bus 30, car 45, walk 25. Test at α=0.05\alpha=0.05 whether grade group and mode of travel are associated in this school's students.

Hypotheses: H0H_0: grade group and mode of travel are independent among students at this school. HaH_a: they are associated. Conditions: random sample, with students under 10% of the school (assume a large school). The column totals are bus 70, car 65 and walk 65, and the table total is 200.

Expected counts: each row total is 100, so bus is 100(70)/200=35100(70)/200=35, car is 100(65)/200=32.5100(65)/200=32.5 and walk is 100(65)/200=32.5100(65)/200=32.5, in both rows. All are at least 5.

Statistic: for row 1, (40−35)2/35=0.7143(40-35)^2/35=0.7143, (20−32.5)2/32.5=4.8077(20-32.5)^2/32.5=4.8077 and (40−32.5)2/32.5=1.7308(40-32.5)^2/32.5=1.7308. Row 2 has the same gaps in reverse, so the same contributions. The sum is χ2=2(7.2528)=14.5055\chi^2=2(7.2528)=14.5055 with (2−1)(3−1)=2(2-1)(3-1)=2 degrees of freedom, and the p-value is e−14.5055/2=0.0007e^{-14.5055/2}=0.0007.

Conclusion: if grade group and mode of travel were independent in this school, a chi-square value of 14.5 or larger would occur only about 0.07% of the time. Since 0.0007<0.050.0007<0.05, we reject H0H_0. There is convincing evidence of an association between grade group and mode of travel for students at this school. The largest contributions come from car use, which is higher than expected for the older group.

Worked example: a fail-to-reject

Use the fertilizer experiment from 3.14: χ2=5.7143\chi^2=5.7143 with 2 degrees of freedom, so the p-value is e−5.7143/2=0.0574e^{-5.7143/2}=0.0574. At α=0.05\alpha=0.05 we fail to reject H0H_0.

The conclusion: there is not convincing evidence that the true survival distributions differ among the three fertilizers. This is not evidence that the fertilizers are equally effective; the p-value is close to 0.05, and a larger experiment might reach a different decision.

How it connects

  • Back to 3.14: the test type, hypotheses and conditions chosen there set up every calculation here.
  • Back to 3.6: the p-value is still a probability computed assuming the null hypothesis.
  • Back to 3.13: with two rows and two columns, the chi-square statistic equals the square of the pooled z-statistic.

Common mistakes

  • Using the wrong degrees of freedom. Use (rows−1)(columns−1)(\text{rows}-1)(\text{columns}-1), not the number of cells minus 1.
  • Including the row and column totals as cells. Only interior cells are summed.
  • Claiming independence after a large p-value. Say there is not enough evidence of an association or a difference.
  • Forgetting context in the conclusion. Name the variables and the population or treatments.

How it shows up on the exam

  • A scenario gives a two-way table and asks for expected counts, the statistic and the conclusion in context.
  • A written prompt asks you to identify the test, the degrees of freedom and what a given p-value means.
  • A multiple-choice item gives expected counts or output and asks which condition or conclusion is valid.

Check yourself

  1. How many degrees of freedom does a table with 4 rows and 3 columns have?
  2. Which cells contribute most to the statistic, and what does that tell you about where the difference lies?
  3. After a large p-value, why is it wrong to say the variables are independent?

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