Chi-Square Test

In short: Chi-square test weighs how far observed category counts stray from the counts a claim predicts, adding up squared gaps scaled by the expected counts, to judge a fit or an association.
AP StatisticsStatisticsAP Statistics Unit 3
What is Chi-Square Test?
A chi-square test asks whether tallies in categories stray from a claim by more than luck would allow. Each observed tally is set against the count expected under the null hypothesis, and the gaps are merged into one number:
\[\chi^2 = \sum \frac{(O – E)^2}{E}\]
Big gaps produce a big \(\chi^2\) and a small p-value. The p-value comes from a chi-square distribution whose shape depends on the degrees of freedom. The goodness-of-fit version has \(df = \text{categories} – 1\); tests for homogeneity or independence use \((\text{rows} – 1)(\text{columns} – 1)\). Each expected count should be at least 5.
How to spot it
- The data are counts in categories, not measurements, and a claim about proportions is being checked.
- A grid of tallies is given and the task is to decide whether two categorical variables are linked, which calls for a chi-square test.
- Two columns of numbers are shown, what was seen and what was predicted.
- A claim says outcomes are equally likely, or follow stated percentages, and a sample is used to challenge it.
The method
- Open the chi-square test with \(H_0\) (the claimed distribution, or no association) and \(H_a\) (it does not fit, or there is an association).
- Find each expected count and confirm every one is at least 5, with a random sample.
- Compute \(\chi^2 = \sum \frac{(O – E)^2}{E}\) and the degrees of freedom.
- Read the p-value from the chi-square curve in the right tail, compare with \(\alpha\), and conclude in context.
Chi-Square Test: solved example
Problem
A board game claims its spinner lands on each of four colors equally often. In 200 spins the counts are red 62, blue 44, green 51, yellow 43. Test the claim at \(\alpha = 0.05\).
Solution
\(H_0\): each color has probability 0.25. Expected count for each color: \(200 \times 0.25 = 50\), which exceeds 5.
\(\chi^2 = \frac{(62-50)^2}{50} + \frac{(44-50)^2}{50} + \frac{(51-50)^2}{50} + \frac{(43-50)^2}{50} = \frac{144 + 36 + 1 + 49}{50} = 4.6\), with \(df = 3\).
The tail area is about 0.20, well above 0.05, so \(H_0\) stands: these counts do not make a convincing case that the spinner is unfair.
Try it
Question 1
Observed counts are 18 and 22, and the expected counts are both 20. Find \(\chi^2\).
Show the answer
\(\frac{(18-20)^2}{20} + \frac{(22-20)^2}{20} = 0.2 + 0.2 = 0.4\).
Question 2
A grid of counts has 3 rows and 4 columns. What df applies to a test of independence?
Show the answer
\((3 – 1)(4 – 1) = 2 \times 3 = 6\).
Chi-Square Test vs. t-Test
A chi-square test works with counts of categorical data and compares whole distributions or tables. The t-test works with a quantitative variable and compares means. Choose by looking at the data type: category counts call for chi-square, measurements call for t.
Keep going
Lessons
Worksheets and quizzes
- Chi-Square Tests – Worksheet
- Chi-Square Tests – Quiz
- Two Categorical Variables and Two-Way Tables – Worksheet
- Two Categorical Variables and Two-Way Tables – Quiz
Related words
Whole dictionary: A–Z · AP Statistics · Statistics