Chi-square test for independence in AP Statistics
In AP Statistics, the chi-square test for independence is a significance test that uses data from a single random sample, classified by two categorical variables in a two-way table, to decide whether there is convincing evidence of an association between those variables in the population.
This definition is part of Fiveable's AP Statistics review, which also has guided practice questions.
What is the Chi-square test for independence?
The chi-square test for independence answers one question. In a single population, are two categorical variables related, or are they independent? You take one random sample, record two categorical variables for each individual (say, age-group and type of sport played), and organize the counts in a two-way (contingency) table.
The hypotheses are always about association. H₀: there is no association between the two variables in the population (they're independent). Hₐ: there is an association. Then you ask what the table would look like if H₀ were true. Each expected count is (row total × column total) ÷ table total. The chi-square statistic, χ² = Σ (observed − expected)² / expected, measures how far your real table drifts from that "no relationship" table. Bigger χ² means more drift and a smaller p-value. Degrees of freedom are (rows − 1)(columns − 1). Think of it as a referee comparing your actual table to a fake table where the variables have nothing to do with each other.
Why the Chi-square test for independence matters in AP® Statistics
This term lives in CED Topics 3.14 (Setting Up a Chi-Square Test for Homogeneity or Independence) and 3.15 (Carrying Out a Chi-Square Test for Homogeneity or Independence). Topic 3.14 is about choosing the right test, writing hypotheses, and checking conditions. Topic 3.15 is about computing expected counts, the χ² statistic, degrees of freedom, and the p-value, then concluding in context. It's the only AP inference procedure built to detect a relationship between two categorical variables with more than two categories each. That makes it the go-to tool whenever a prompt asks "is there an association between X and Y?" and both X and Y are categories. It also ties together big course themes: random sampling, the logic of significance testing, and the difference between association and causation.
Keep studying AP® Statistics Unit XXGRYZTH6sTfEcdI
How the Chi-square test for independence connects across the course
Chi-Square Test for Homogeneity (Unit 3)
Same math, different study design. Independence uses one sample measured on two variables. Homogeneity uses separate samples (or treatment groups) compared on one variable. Expected counts, χ², and df are calculated exactly the same way, so the design is the only thing that tells you which test you're running.
Contingency Table (Unit 3)
The two-way table is the raw material for the test. Comparing conditional distributions in the table gives you a description of a possible association, and the chi-square test tells you whether that pattern is too strong to blame on random sampling.
Chi-Square Statistic and Degrees of Freedom (Unit 3)
χ² adds up each cell's squared gap between observed and expected, scaled by the expected count. Degrees of freedom, (r − 1)(c − 1), pick which chi-square curve you use to get the p-value. A 3×3 table has 4 df, not 9.
Null Hypothesis, Significance Level, and Simple Random Sample (Unit 3)
The usual testing logic still applies. Assume no association, check conditions (random sample, 10% condition if sampling without replacement, all expected counts at least 5), then compare the p-value to α. The random sample is what lets you generalize the result to the whole population.
Is the Chi-square test for independence on the AP® Statistics exam?
Multiple-choice questions love the "which test?" setup. You'll see stems like "A researcher wants to determine if there is a relationship between political affiliation and stance on climate change" and have to pick independence (one sample, two variables, association hypotheses). Distractors often swap in homogeneity hypotheses ("the distributions are the same across groups"). That's the right answer for prompts like comparing blood-type distributions across four ethnic groups or treatment outcomes across three medications, where separate groups are compared on one variable.
On free response, you're expected to run the full procedure. Name the test, state H₀ and Hₐ in context, check conditions (random, 10%, expected counts ≥ 5), calculate χ², df, and the p-value, then conclude in context. The 2026 FRQ Q5 asked about an association between age-group and type of sport among professional athletes, which is a textbook independence setup. Chi-square reasoning also appeared on 2024 FRQ Q1 and Q5. Common point-losers include writing hypotheses with no context, checking observed instead of expected counts, and claiming causation from observational data.
The Chi-square test for independence vs Chi-square test for homogeneity
Ask how the data were collected. If one random sample was classified by two categorical variables, use independence. The hypotheses are about whether there's an association. If two or more separate samples or treatment groups were compared on one categorical variable, use homogeneity. The hypotheses say the distribution is the same for every group. The calculations are identical, so the hypotheses and the design description are where you earn or lose credit.
Key things to remember about the Chi-square test for independence
The chi-square test for independence uses one random sample and two categorical variables to test whether the variables are associated in the population.
The null hypothesis says there is no association between the variables, and the alternative says there is an association, both stated in context.
Each expected count equals the row total times the column total divided by the table total, and every expected count must be at least 5.
Degrees of freedom equal (number of rows − 1) times (number of columns − 1), and a larger χ² value gives a smaller p-value.
If the setup is several separate groups compared on one variable, you need the test for homogeneity instead, even though the math is the same.
Rejecting the null hypothesis shows evidence of an association, not proof that one variable causes the other.
Frequently asked questions about the Chi-square test for independence
What is the chi-square test for independence in AP Stats?
It's a significance test that checks whether two categorical variables are associated in a single population, using counts from one random sample organized in a two-way table. It compares observed counts to the counts you'd expect if the variables were independent.
How is the chi-square test for independence different from the test for homogeneity?
Independence uses one sample measured on two variables and tests for an association. Homogeneity uses separate samples or groups measured on one variable and tests whether the distributions are the same. For example, relating political affiliation to climate stance in one sample of 500 people is independence, while comparing blood-type distributions across four ethnic groups is homogeneity.
Does rejecting the null in a chi-square test for independence prove one variable causes the other?
No. Rejecting H₀ only gives convincing evidence of an association. Since this test uses data from a sample survey or observational study, you can't conclude causation.
Can I use percentages instead of counts in a chi-square test?
No. χ² must be calculated from counts, and the expected-counts condition (every expected count at least 5) is checked on counts too. Percentages are great for describing conditional distributions, but they can't go into the formula.
How do you find degrees of freedom for a chi-square test for independence?
Use df = (rows − 1)(columns − 1). A table with 3 sport types and 4 age-groups has (3 − 1)(4 − 1) = 6 degrees of freedom.
Keep studying AP Statistics
Connect this key term to the AP exam workflow: review the course, practice questions, and check related study tools.
AP Statistics hub
Review units, study guides, and course resources.
AP-style practice
Check this vocabulary in multiple-choice context.
FRQ practice
Apply key concepts in written AP responses.
Score calculator
Estimate the exam score you are working toward.
Cheatsheets
Review the highest-yield facts before practice.
Practice exam
Put the full course together before test day.