AP Statistics Chi-Square Tests Lesson (Free PDF)
This chi square lesson for AP Statistics covers chi-square tests (Common Core AP STAT 8.1, AP STAT 8.2, AP STAT 8.3, AP STAT 8.4, AP STAT 8.5, AP STAT 8.6, AP STAT 8.7), with a free PDF to print.
A chi-square test compares observed counts with the counts expected under the null hypothesis, using the sum of (O – E)^2/E and a p-value. Goodness-of-fit has df = categories – 1; a two-way table has E = row total times column total over grand total and df = (r – 1)(c – 1). Expected counts must be at least 5.
AP Statistics · Common Core State Standards: AP STAT 8.1, AP STAT 8.2, AP STAT 8.3, AP STAT 8.4, AP STAT 8.5, AP STAT 8.6, AP STAT 8.7
Key facts in this chi square lesson
- chi-square = sum of (O – E)^2 / E; right-tailed p-value; distribution skewed right.
- Goodness-of-fit: one categorical variable; df = number of categories – 1.
- Two-way table: E = row total x column total / grand total; df = (r – 1)(c – 1).
- Conditions: random sample or random assignment, and all expected counts at least 5.
- Homogeneity: compare distributions across groups; independence: two variables in one sample.
What is a chi-square test?
A chi-square test compares observed counts in categories with the counts we would expect if a claim were true. The test statistic adds up the squared differences, scaled by the expected counts:
\[\chi^{2}=\sum\frac{(O-E)^{2}}{E}\]
Large values of \(\chi^{2}\) mean the data are far from what the null hypothesis predicts. The p-value is the area to the right of \(\chi^{2}\) under a chi-square distribution with the appropriate degrees of freedom. These distributions are skewed right.
How does a goodness-of-fit test work?
A goodness-of-fit test checks whether one categorical variable has a claimed distribution. Example: a manager claims that late arrivals are equally likely on each of 5 weekdays. In 250 late arrivals, the counts are 58, 48, 44, 42, 58.
- \(H_0\): the proportion of late arrivals is 0.20 on each weekday. \(H_a\): at least one proportion differs.
- Conditions: random sample, and all expected counts at least 5 (here 50 each).
- \(\chi^{2}=\frac{(58-50)^{2}}{50}+\frac{(48-50)^{2}}{50}+\frac{(44-50)^{2}}{50}+\frac{(42-50)^{2}}{50}+\frac{(58-50)^{2}}{50}=4.64\) with \(df=5-1=4\).
The p-value is \(0.3263\), greater than 0.05, so we fail to reject \(H_0\). There is not convincing evidence that late arrivals are unevenly distributed across weekdays.
How do you test two categorical variables?
For a two-way table, the expected count in each cell is \(E=\frac{\text{row total}\times\text{column total}}{\text{grand total}}\), and \(df=(r-1)(c-1)\). The same formula gives \(\chi^{2}\). Use a test for homogeneity when comparing the distribution of one variable across several populations or treatments, and a test for independence when you classify one sample by two variables.
Here \(\chi^{2}=8.75\), \(df=(2-1)(3-1)=2\), and the p-value is \(0.0126\). Since this is less than 0.05, we reject \(H_0\): there is convincing evidence of an association between class and study location (the seniors prefer the library more than the sophomores do).
Chi square lesson: questions and answers
What does a large chi-square statistic mean?
It means the observed counts differ greatly from the expected counts under H0. The larger the statistic, the smaller the p-value and the stronger the evidence against H0.
What is the condition for using a chi-square test?
The data must come from a random sample or randomized experiment, and every expected count must be at least 5. Observed counts may be small, but expected counts may not.
What is the difference between homogeneity and independence?
Homogeneity compares the distribution of one categorical variable across several separate populations or treatments. Independence asks whether two categorical variables are related in a single sample. The calculation is identical; the wording of the hypotheses differs.
How do I find the degrees of freedom?
For goodness-of-fit, df is the number of categories minus 1. For a two-way table, df is (number of rows – 1) times (number of columns – 1).
Which cells contribute the most to chi-square?
Compute (O – E)^2 / E for each cell. The largest contributions show where the data differ most from H0, which is useful in your conclusion.
How to use this chi square lesson
Read the definitions first, then follow the worked method line by line and redo the example on paper without looking. When every step makes sense, move on to the worksheet, then check yourself with the quiz.
Download the chi square lesson as a PDF with the button below and keep it with your notes.
Download the chi square lesson as a PDF with the button below and keep it with your notes.
All AP Statistics chapters: AP Statistics math.
More AP Statistics math
Lessons
See allWorksheets
See allTests
See allInference for the Difference of Two Means Test with Point Values
Sampling Distributions and the Central Limit Theorem Test with Point Values
Five-Number Summary, Boxplots and Comparing Distributions Test with Point Values
Experimental Design and Random Assignment Test with Point Values
t Intervals and t Tests for a Mean Test with Point Values
Binomial and Geometric Distributions Test with Point Values

























