Chi-square test
Also known as: chi-squared test, χ² test
A chi-square test is a statistical hypothesis test for categorical data that compares observed counts to expected counts. Common versions test goodness of fit, independence between two variables, and homogeneity across populations.
A chi-square test is a hypothesis test for categorical data. It measures how far the observed counts in each category fall from the counts you would expect if the null hypothesis were true, using the statistic χ² = Σ (observed − expected)² / expected. A large χ² value means the data deviate substantially from expectations, producing a small p-value and evidence against the null hypothesis.
There are three standard versions. The goodness-of-fit test checks whether a single categorical variable follows a claimed distribution — for example, whether a die is fair based on 600 rolls. The test for independence uses a two-way table from one sample to check whether two variables, such as gender and voting preference, are associated. The test for homogeneity uses samples from several populations to check whether they share the same distribution of a categorical variable.
Each test compares the χ² statistic to a chi-square distribution with the appropriate degrees of freedom: categories minus 1 for goodness of fit, or (rows − 1)(columns − 1) for two-way tables. Conditions include random sampling and all expected counts of at least 5. Note that a significant result shows association, not causation — and the test says nothing about the direction or strength of the relationship.
Chi-square procedures are a required topic on the AP Statistics exam. You should be able to choose the correct chi-square test for a scenario, compute expected counts and degrees of freedom, check conditions, and interpret the p-value in context.
Key takeaways
- Chi-square tests analyze categorical data by comparing observed counts to expected counts.
- The statistic is χ² = Σ (observed − expected)² / expected; larger values give stronger evidence against the null hypothesis.
- The three versions are goodness of fit, independence, and homogeneity.
- Degrees of freedom are (categories − 1) for goodness of fit and (rows − 1)(columns − 1) for two-way tables.
- All expected counts should be at least 5 for the test to be valid.
