Skip to main content
United StatesStatisticsSyllabus dot point

How do you compute the chi-square statistic and P-value and conclude a test of homogeneity or independence?

Topic 8.6 Carrying Out a Chi-Square Test for Homogeneity or Independence: compute the chi-square statistic from a two-way table, find the P-value using (rows minus 1)(columns minus 1) degrees of freedom, and state a conclusion in context.

A focused answer to AP Statistics Topic 8.6, on computing the chi-square statistic from a two-way table, finding the P-value with (r minus 1)(c minus 1) degrees of freedom, and stating a conclusion in context, with a full worked test.

Generated by Claude Opus 4.811 min answer

Reviewed by: AI editorial process; not yet individually human-reviewed

Have a quick question? Jump to the Q&A page

Jump to a section
  1. What this topic is asking
  2. The statistic and degrees of freedom
  3. From statistic to conclusion
  4. What a significant result does and does not say
  5. Try this

What this topic is asking

The College Board (Topic 8.6) wants you to carry out and conclude a chi-square test of homogeneity or independence: compute the chi-square statistic from the two-way table, find the P-value with (r1)(c1)(r - 1)(c - 1) degrees of freedom, compare to α\alpha, and state a conclusion in context.

The statistic and degrees of freedom

The statistic is the same (OE)2/E\sum (O - E)^2 / E as goodness of fit, now summed over every cell of the table. The only computational difference from the one-variable test is the degrees of freedom: (r1)(c1)(r - 1)(c - 1) instead of k1k - 1. For a 2×22 \times 2 table, df=1df = 1; for a 3×43 \times 4 table, df=6df = 6. As before, the chi-square distribution is right-skewed, so the P-value is the upper tail only, never doubled.

From statistic to conclusion

The decision rule is standard; the conclusion wording follows the design. For homogeneity, conclude about the distribution differing across groups ("there is convincing evidence the distribution of preference differs among the regions"). For independence, conclude about an association between two variables ("there is convincing evidence that exercise habit and sleep quality are associated"). Matching the conclusion to the test type is graded, and a homogeneity conclusion phrased as "associated" (or vice versa) loses the contextual mark.

What a significant result does and does not say

A rejected test says the distributions differ (or the variables are associated) somewhere in the table, but does not say which cells or how. To discuss where the effect lies, inspect the individual cell contributions (OE)2/E(O - E)^2 / E: the largest terms identify the cells driving the result. And, as always, a chi-square test of independence shows association, not causation; only a randomised experiment supports a causal claim. Likewise, a non-significant result does not prove the distributions are identical or the variables independent, it only fails to find evidence against the null. Reporting these limits is part of a complete answer.

Try this

Q1. A 4×34 \times 3 table is tested. Find the degrees of freedom. [1 point]

  • Cue. df=(41)(31)=3×2=6df = (4-1)(3-1) = 3 \times 2 = 6.

Q2. A test of independence is significant. State two things it does NOT establish. [2 points]

  • Cue. It does not establish causation (association is not causation), and it does not identify which specific cells differ (inspect the largest (OE)2/E(O-E)^2/E contributions for that).

Exam-style practice questions

Practice questions written in the style of College Board exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.

AP 2018 (style)1 marksSection I (multiple choice). A two-way table has 33 rows and 44 columns. The chi-square degrees of freedom are (A) 1212 (B) 77 (C) 66 (D) 1111
Show worked answer →

The correct answer is (C).

For a two-way table, df=(rows1)(columns1)=(31)(41)=2×3=6df = (\text{rows} - 1)(\text{columns} - 1) = (3-1)(4-1) = 2 \times 3 = 6.

(A) is rows times columns. (B) is rows plus columns. (D) is the total cells minus one. The correct value is 66.

AP 2022 (style)4 marksSection II (free response). A single random sample of 200200 adults is classified by exercise habit (regular/irregular) and sleep quality (good/poor). Observed: regular and good 7070, regular and poor 3030, irregular and good 4040, irregular and poor 6060. Test at α=0.05\alpha = 0.05 whether exercise habit and sleep quality are associated. Compute the chi-square statistic and P-value (use df=1df = 1), and conclude in context (justify in context).
Show worked answer →

A 4-point test of independence.

(1) (1 point) H0H_0: exercise habit and sleep quality are independent; HaH_a: they are associated. One random sample; expected counts checked 5\ge 5.
(2) (1 point) Row totals: regular 100100, irregular 100100; column totals: good 110110, poor 9090; grand total 200200. Expected: regular-good =100×110200=55= \dfrac{100 \times 110}{200} = 55, regular-poor =45= 45, irregular-good =55= 55, irregular-poor =45= 45. All 5\ge 5.
(3) (1 point) χ2=(7055)255+(3045)245+(4055)255+(6045)245=22555+22545+22555+225454.09+5.00+4.09+5.00=18.18\chi^2 = \dfrac{(70-55)^2}{55} + \dfrac{(30-45)^2}{45} + \dfrac{(40-55)^2}{55} + \dfrac{(60-45)^2}{45} = \dfrac{225}{55} + \dfrac{225}{45} + \dfrac{225}{55} + \dfrac{225}{45} \approx 4.09 + 5.00 + 4.09 + 5.00 = 18.18, df=1df = 1. P-value =P(χ12>18.18)<0.001= P(\chi^2_1 > 18.18) < 0.001.
(4) (1 point) Since P-value <0.001<0.05< 0.001 < 0.05, reject H0H_0. There is convincing evidence that exercise habit and sleep quality are associated.

Markers reward expected counts, the chi-square sum, df=(21)(21)=1df = (2-1)(2-1) = 1, the P-value, and a contextual conclusion.

Related dot points

Sources & how we know this