AP Statistics · Unit 3 · Topic 3.14

    3.14 Setting Up a Chi-Square Test for Homogeneity or Independence

    Reviewed by P V Satish, Senior Faculty of Science and Academic Consultant · PG Life Sciences, PGD Biotechnology · 20+ years teaching NEET and AP · Special interest in biotechnology, biochemistry and the basics of physics
    Updated

    In short

    Use a chi-square test for homogeneity when you have separate samples or treatment groups and one categorical variable: H₀ says the distribution of the variable is the same in every population. Use a chi-square test for independence when you have one sample and two categorical variables: H₀ says there is no association. Both use expected counts row total×column totaltable total\frac{\text{row total} \times \text{column total}}{\text{table total}}, degrees of freedom (r − 1)(c − 1), and need all expected counts at least 5.

    What you need to know

    • Choose between a chi-square test for homogeneity and a test for independence.
    • Write the hypotheses for each test in context.
    • Calculate expected counts and degrees of freedom for a two-way table.
    • Verify the conditions for a chi-square test.

    Homogeneity or independence?

    Both tests start from a two-way table of counts, and the arithmetic is identical. The difference is how the data were collected, which changes the hypotheses and the conclusion.

    Choosing the test
    HomogeneityIndependence
    Data collectionSeparate random samples from two or more populations (or groups from random assignment)One random sample, each individual classified on two variables
    QuestionIs the distribution of one variable the same in every population?Is there an association between the two variables in the population?
    H₀The distribution of [variable] is the same for all [populations]There is no association between [variable 1] and [variable 2]

    Example: homogeneity

    Independent random samples of 100 students were taken at School X and School Y and asked their preferred way to revise: flashcards, videos or written notes.

    Observed counts
    FlashcardsVideosNotesTotal
    School X453025100
    School Y304030100
    Total757055200
    The conditional distributions differ; the test asks whether the difference is bigger than chance.

    Hypotheses. H₀: the distribution of preferred revision method is the same for all students at School X and all students at School Y. Hₐ: the distributions are not the same.

    Expected counts come from assuming H₀: if both schools shared the overall distribution (75/200 flashcards, and so on), School X's expected flashcards count would be 100 × 75/200 = 37.5. In general, expected = (row total × column total) ÷ table total. Here every School X and School Y row is 37.5, 35 and 27.5.

    Degrees of freedom = (rows − 1)(columns − 1) = (2 − 1)(3 − 1) = 2.

    Conditions

    • Random: independent random samples (homogeneity) or one random sample (independence), or random assignment.
    • 10%: each sample is less than 10% of its population when sampling without replacement.
    • Large counts: every expected count is at least 5 (here 27.5 is the smallest).

    For an independence test, the same steps apply with one sample. Example: one random sample of 300 students at a large school is classified by year (junior or senior) and plan after school (university, work, undecided). H₀: there is no association between year and plan among all students at the school; Hₐ: there is an association. Topic 3.15 carries out both tests.

    Key terms

    Chi-square test for homogeneity
    Tests whether the distribution of one categorical variable is the same across several populations or treatments.
    Chi-square test for independence
    Tests whether two categorical variables measured on one sample are associated in the population.
    Expected count
    (row total × column total) ÷ table total: the count expected if H₀ were true.
    Degrees of freedom
    (number of rows − 1)(number of columns − 1) for a two-way table.

    Common mistakes

    • Choosing the test by the shape of the table.

      Choose by how the data were collected: several samples or one.

    • Checking that observed counts are at least 5.

      The condition is on expected counts.

    • Writing hypotheses with proportions from the sample.

      State hypotheses about the populations, in words.

    How this topic is tested

    • Write hypotheses in words, in context; no symbols are needed.
    • Show one expected-count calculation, then list the rest.
    • Name the test exactly: 'chi-square test for homogeneity' or 'for independence'.

    Practice questions

    Original AP-style multiple-choice questions. Pick an answer to see the explanation.

    1. Question 1 · SP 1 · Formulate Questions

      A researcher takes one random sample of 500 adults and records their age group and their favourite news source. Which test fits?

    2. Question 2 · SP 3 · Analyze Data

      In a 3 × 4 two-way table, the degrees of freedom are:

    3. Question 3 · SP 3 · Analyze Data

      Row total 120, column total 80, table total 400. The expected count for that cell is:

    4. Question 4 · SP 1 · Formulate Questions

      Three hospitals each provide a random sample of patients, classified by satisfaction (low, medium, high). The null hypothesis is:

    5. Question 5 · SP 2 · Collect Data

      Which condition must be checked before a chi-square test?

    Free-response practice

    Write your answer first, then mark it against the scoring guide.

    Inference (set-up) · 4 points

    In a randomized experiment, 90 volunteers were assigned at random to three study-break lengths (5, 15 or 30 minutes), 30 per group. Each then rated their focus as low, medium or high.

    1. (a) Identify the appropriate test and state hypotheses.
    2. (b) If 36 volunteers in total rated focus 'high', find the expected count of 'high' in the 5-minute group, and the df.

    Connected topics

    Frequently asked questions

    Is the chi-square goodness-of-fit test still in the course?

    No. It was removed in the 2026 course revision; only homogeneity and independence remain.

    Can a 2 × 2 table use a chi-square test?

    Yes. For two groups and a yes/no variable, the chi-square test for homogeneity matches a two-sided two-proportion z-test.

    Do I need symbols in the hypotheses?

    No. Clear words in context are best for chi-square tests.

    How this shows up on the exam42 multiple-choice questions and 4 free-response questions of 10 points. See what each one asks you to do.Full-length AP Statistics practice examsUnit 3 is one of 5 units on the exam. Two timed exams in the 2027 format (42 MCQ + 4 FRQ), with explanations, scoring guides and an estimated 1–5 score. $14.99 · try 5 questions free.

    Free Unit 3 cheat sheet

    Every topic in Unit 3: Inference for Categorical Data: Proportions on a few printable pages: the core idea, key terms, the two traps students fall into and what the exam asks.

    We'll use your email to tell you when new AP Statistics practice material is ready. No spam, and we'll delete it if you ask.

    Free Unit 3 practice test: 75 questions with explanations

    All topics in Unit 3: Inference for Categorical Data: Proportions

    1. 3.1 Estimators
    2. 3.2 Sampling Distributions for Sample Proportions
    3. 3.3 Constructing a Confidence Interval for a Population Proportion
    4. 3.4 Justifying a Claim Based on a Confidence Interval for a Population Proportion
    5. 3.5 Setting Up a Test for a Population Proportion
    6. 3.6 p-Values
    7. 3.7 Carrying Out a Test for a Population Proportion
    8. 3.8 Potential Errors When Performing Tests
    9. 3.9 Sampling Distributions for the Difference Between Sample Proportions
    10. 3.10 Constructing a Confidence Interval for the Difference Between Two Population Proportions
    11. 3.11 Justifying a Claim Based on a Confidence Interval for the Difference Between Two Population Proportions
    12. 3.12 Setting Up a Test for the Difference Between Two Population Proportions
    13. 3.13 Carrying Out a Test for the Difference Between Two Population Proportions
    14. 3.14 Setting Up a Chi-Square Test for Homogeneity or Independence
    15. 3.15 Carrying Out a Chi-Square Test for Homogeneity or Independence

    Other units in AP Statistics

    AP® is a trademark registered by College Board, which is not affiliated with, and does not endorse, this website.