AP Statistics / Unit 3: Inference for Categorical Data: Proportions / Topic 3.14
NUM8ERS study notes · Topic 3.14

Setting Up a Chi-Square Test for Homogeneity or Independence

A two-way table can answer two different kinds of questions. Learn to choose the test from the study design, write clear hypotheses and check whether a chi-square model is appropriate.

2026–27 curriculum6 worked examples10 practice questions6 visual guides

By the end of this lesson, you should be able to:

  • Distinguish comparing distributions across populations from testing association within 11 population.
  • Choose homogeneity or independence using how the data were collected.
  • Write hypotheses that name the categorical variable or variables and the population or populations.
  • Check randomization, independence of observations, the 10%10\% condition when needed and every expected cell count.
  • Describe chi-square curves and how their shape changes with degrees of freedom.
  • Explain what a complete test setup establishes and what still needs a calculation.

Before you start: Review two-way tables, conditional proportions and Topic 3.13’s population-test reasoning. Each individual should contribute 11 count to a clearly defined row-and-column combination.

First time learning this? Follow the three-school preference study, then compare it with a single-school survey.

Here to revise? Use the method-and-conditions checklist, then attempt the practice questions before opening the solutions.

The concept in 60 seconds

Researchers independently select random samples from Schools A, B and C. Each student chooses 11 preferred notes format: digital only, printed only or a mixed format. The researchers ask whether the distribution of preferences is the same across the 33 school populations.

This is a chi-square test for homogeneity. “Homogeneity” means sameness: under the null, the populations share the same preference distribution. The observed samples need not have identical counts or percentages.

Visual guide 1: start with the population question
Several populationsCompare the same response

Independent samples at Schools A, B and C; notes-format preference in each. Choose homogeneity.

11 populationRelate 22 categorical variables

11 academy sample; grade level and notes-format preference recorded for every student. Choose independence.

Both designsCompare observed and expected counts

Write the appropriate population null and alternative, then justify the design and every expected cell.

A two-way table organizes the counts. Its dimensions alone do not tell you whether the populations were separately sampled or whether 11 sample was classified by 22 variables.

Now imagine a different design: 11 random sample from a single school, with each student classified by grade level and preferred notes format. The question is whether those 22 categorical variables are associated in that school’s population. This is a chi-square test for independence.

The key choice: comparing 11 categorical distribution across separately sampled populations or assigned treatments → homogeneity. Looking for an association between 22 categorical variables in 11 sampled population → independence. Start with the design and question.

All numerical studies on this page are fictional teaching examples. This lesson builds and justifies a test plan; Topic 3.15 uses that plan to calculate the test statistic, pp-value and conclusion.

Quick check: does a 3×33 \times 3 table automatically mean a test for independence?

No. The same table dimensions can come from independent samples of 33 populations or 11 sample classified by 22 variables. The sampling design and research question determine the test name.

Choose the test from the study design

Homogeneity: compare population or treatment distributions

Take independent random samples from 22 or more populations and measure the same categorical response in each. Alternatively, randomly assign experimental units to treatments and compare the categorical outcome distributions. Name the populations or treatments and the response variable.

In the school study, samples of 100,120, and 80100, 120,\text{ and }80 students are taken separately from A, B and C. The variable is preferred notes format, with the same 33 categories at every school.

Observed preferences from 33 independent school samples. Each student contributes 11 count.
PopulationDigital onlyPrinted onlyMixedTotal
School A606025251515100100
School B545436363030120120
School C3636292915158080
Total15015090906060300300

Different sample sizes make raw-count comparisons misleading. For example, 6060 digital preferences out of 100100 at A is 60%60\%; 5454 out of 120120 at B is 45%45\%. A homogeneity null concerns the population category proportions, rather than equality of sample counts.

Independence: relate 22 variables in 11 population

Take 11 random sample from 11 population, then record 22 categorical variables for each individual. For example, sample 300300 students at 11 academy and record grade level (9, 10 or 11) and preferred notes format.

Visual guide 2: the same count array can have two study designs
Design A: independent population samplesSchool A / School B / School C

Samples are separately taken from the 33 schools. Compare the distribution of preferred notes format across populations: homogeneity.

Design B: 11 population sampleGrade 9 / Grade 10 / Grade 11

11 sample from an academy’s grades 9–11 population is classified by grade and format. Ask about association: independence.

Both designs can produce the same 99 cell counts and expected-count arithmetic. Their questions, hypotheses and sampling checks still refer to different populations and designs.

Choose the method using the question and how observations were selected.
Design and questionMethodName in your setup
Independent random samples from several populations; compare the same categorical response distributions.Chi-square test for homogeneityThe categorical response and all sampled populations.
Random assignment to treatments; compare categorical outcome distributions.Chi-square test for homogeneityThe categorical outcome and assigned treatments.
11 random sample; investigate association between 22 categorical variables.Chi-square test for independenceBoth categorical variables and the single target population.
The same people before and after; investigate a change in marginal proportions.Requires an appropriate paired-change methodThe linked observations and the change question; do not invent independent groups.
Quantitative measurements such as test-score means.Use an appropriate quantitative-data methodThe population quantitative outcome; categorical counts answer a different question.

Keep the counting unit clear

A cell count is the number of individuals in a row-and-column combination. Give each individual exactly 11 category for each variable. If students select several separate options, counting each selection as a different student changes the data structure. A “mixed format” category can work when it is 11 clearly defined, exclusive response.

11 sample can contain several groups after classification. Finding grade-level groups inside a single SRS does not turn it into separately collected samples. Conversely, two-way row labels alone do not reveal how observations were selected.

Quick check: 11 SRS of city residents records age group and preferred transport mode. Which test fits?

A chi-square test for independence, if its conditions hold. The 22 categorical variables are age group and preferred transport mode, and the target is their association in the city-resident population.

Write contextual null and alternative hypotheses

Write hypotheses about the population distributions or population association. Ordinary wording is often clearer than forcing a long list of symbols.

Write hypotheses about population distributions or association.
TestNull H0H_{0}Alternative HaH_{a}
HomogeneityThe categorical response distribution is the same across the populations or treatments.The distributions are not all the same; at least 11 differs.
IndependenceThe 22 categorical variables are independent in the target population.The 22 categorical variables are associated in that population.

Homogeneity: the three-school study

H0H_{0}: The distribution of preferred notes format—digital only, printed only or mixed—is the same among all students at Schools A, B and C.

HaH_{a}: The distribution of preferred notes format is not the same across all 33 school populations; at least 11 population distribution differs.

The null means that the digital proportion is the same across schools, the printed proportion is the same across schools and the mixed proportion is the same across schools. It does not require the 33 categories to be equally likely. A shared distribution could be 50%50\% digital, 30%30\% printed and 20%20\% mixed.

The alternative does not claim that every school differs from every other school or that every category differs. At least 11 difference somewhere is enough for the general alternative.

Independence: a single-school survey

H0H_{0}: Grade level and preferred notes format are independent, or have no association, among all students in grades 9–11 at the sampled academy.

HaH_{a}: Grade level and preferred notes format are associated among those students.

Under independence, the population distribution of notes format is the same across grade levels. Under association, knowing the grade level changes the distribution of format preference.

Keep 22 meanings of independence separate. Independent observations are a design requirement. Independence of the 22 categorical variables is the null claim being investigated. Assuming the variables are independent as a condition would assume the answer to the research question.

Quick check: does the homogeneity alternative mean that all population distributions must be different?

No. It means they are not all the same. 11 population differing from another in at least 11 category is enough; the setup does not identify which category differs.

Understand expected cell counts

An observed count OO is what the sample actually contains. An expected count EE is the count predicted by the null model using the table’s marginal totals.

To check the expected-count condition, calculate each interior cell using:

E=row total×column totalgrand totalE=\frac{\text{row total}\times\text{column total}}{\text{grand total}}

This formula applies to both homogeneity and independence. It combines the null-model category proportions with the relevant group size, while preserving the row and column totals.

Visual guide 3: turn the shared category proportion into a count
Combined digital proportion150300=0.50\frac{150}{300}=0.50

Under the homogeneity null, estimate 11 common category share from all 33 samples.

School A sample size100100 students

Use this row’s actual size. Unequal school samples have unequal expected counts.

Expected A digital count100×0.50=50100 \times 0.50=50

Observed is 6060. The expected count describes the null model, rather than an equal-category assumption.

Equivalent arithmetic: E=100×150300E=\frac{100 \times 150}{300}. The combined category shares are 0.500.50 digital, 0.300.30 printed and 0.200.20 mixed; homogeneity allows these shares to be unequal.

School A’s digital-format cell

The A row total is 100100; the digital column total is 150150; the grand total is 300300. Therefore:

EA,digital=100×150300=50E_{\mathrm{A,digital}}=\frac{100\times150}{300}=50

The observed count is 6060. Expected 5050 means that A’s sample of 100100 would have 5050 digital preferences under the estimated common 50%50\% digital rate. The difference of 1010 is one piece of sample evidence; it is not yet a test decision.

Expected preferences under the common-distribution null. Totals are preserved; check the 99 interior cells.
PopulationDigital onlyPrinted onlyMixedTotal
School A505030302020100100
School B606036362424120120
School C4040242416168080
Total15015090906060300300

The 99 interior expected counts are 50,30,2050, 30, 20; 60,36,2460, 36, 24; and 40,24,1640, 24, 16. The smallest is 1616. Expected counts can be decimals; do not round them to whole people before checking a threshold or calculating a statistic.

Two useful arithmetic checks

  • Expected counts in each row add to the original row total.
  • Expected counts in each column add to the original column total; all cells together add to the grand total.

Do not put a row percentage into the table as if it were a count. If only percentages are given, you need the relevant sample sizes to obtain the count data.

Quick check: why is A’s expected digital count 5050, rather than 1003\frac{100}{3}?

The null assumes the same distribution across populations, not equal shares across categories. The combined data estimate the digital share as 150300=0.50\frac{150}{300}=0.50, so A’s expected digital count is 100(0.50)=50100(0.50)=50.

Check randomization, independence and expected counts

1. Randomization and independent observations

For homogeneity, identify the independent random samples or the appropriate randomized experiment. For independence, identify the random sample from the single population. Describe the actual design given in the problem.

Observations must be appropriately independent. The same person should not be treated as several independent people, and linked groups require suitable analysis. A huge voluntary website poll does not become an SRS because it has many responses. Count checks do not repair recruitment bias.

2. The 10%10\% condition when sampling without replacement

For homogeneity with separately sampled finite populations, check n≤0.10Nn\le 0.10N for each population individually. Schools A, B and C contain 5,000,6,000, and 4,0005{,}000, 6{,}000,\text{ and }4{,}000 students:

  • School A: 100≤500100\le 500.
  • School B: 120≤600120\le 600.
  • School C: 80≤40080\le 400.

For independence with 11 sample, check the whole sample against the 11 target population. For the academy sample of 300300 from 6,0006{,}000 students, check 300≤600300\le 600. Row groups found after sampling do not require invented population sizes.

The sampling 10%10\% condition is not required merely for random assignment. A separate finite-population sampling stage can still require its own check. Do not compare each assigned group with 10%10\% of the participant pool. If a sampling problem omits population sizes, state what would be needed to justify the check; do not invent a size.

3. Every expected cell count must exceed 55

For the 2026–27 AP Statistics curriculum used here, every interior expected count should be greater than 55. The official CED, Topic 3.14.D.1.iii (printed page 111), states this condition. Check the expected cells, excluding marginal totals.

Our school table passes because all 99 expected counts exceed 55; the minimum is 1616. A total sample of 300300 alone is not the justification.

Boundary reminder: follow E>5E > 5 in this lesson. An exact expected count of 55 does not meet that strict wording. Some other texts use E≥5E\ge 5; keep the criterion consistent with the curriculum or task you are following. A value below 55 does not become adequate by rounding.

Visual guide 4: observed counts do not replace the expected-count check
Expected versus observed count for a rare-category cellHorizontal bars for one rare-category cell in a fictional two-college sample. Expected count is 2, shown by a solid olive bar; observed count is 5, shown by a hatched bar. The count axis starts at zero, and a dashed benchmark marks 5. Every expected cell must be greater than 5 under this lesson’s criterion, so the expected count of 2 fails. 0 2 5 6 Cell count Expected Observed 2 5 Check the expected cell count, not the observation Small-group rare-category cell: E = 20 × 20 / 200 = 2. Dashed benchmark = 5; the required expected count is greater than 5. Only the small-group rare-category cell is plotted. Other expected counts: 18, 18 and 162. All four observed counts are at least 5. The expected-count condition still fails. Expected versus observed count for a rare-category cellHorizontal bars for one rare-category cell in a fictional two-college sample. Expected count is 2, shown by a solid olive bar; observed count is 5, shown by a hatched bar. The count axis starts at zero, and a dashed benchmark marks 5. Every expected cell must be greater than 5 under this lesson’s criterion, so the expected count of 2 fails. 0 2 5 6 Cell count Expected Observed 2 5 Check expected counts, not observed counts Small-group rare-category cell Expected = 20 × 20 / 200 = 2 Criterion: every expected count > 5 Observed count 5 is not the check. Expected count 2 fails. The other expected counts: 18, 18 and 162.

Only the smaller sample’s rare-category cell is plotted. Row totals are 2020 and 180180, column totals 2020 and 180180, and grand total 200200. The expected-count table is 2,182, 18; 18,16218, 162. Independent SRSs and both 10%10\% checks pass in this example; the expected-count condition does not.

In the separate small-group example, the 44 expected counts are 2,18,18, and 1622, 18, 18,\text{ and }162. The first fails. All 44 observed counts are at least 55, but that is not the required check.

An observed 00 does not automatically cause failure when its expected count exceeds 55 and that cell is genuinely possible. A structurally impossible category combination is a different model issue; do not treat it as an ordinary chance observation.

Quick check: 88 expected counts exceed 55 and 11 is 3.23.2. Is the condition met?

No. Every interior expected cell count must exceed 55 under the criterion used here. State the failed cell instead of claiming that a large grand total makes the condition acceptable.

Understand chi-square curves

The symbol χ2\chi^{2} is read “chi-square.” A chi-square statistic measures how far observed counts are from expected counts relative to the expected counts.

Preview:

χ2=∑interior cells(O−E)2E\chi^2=\sum_{\text{interior cells}}\frac{(O-E)^2}{E}

The sum includes every interior cell.

Each squared difference contributes a nonnegative amount when E>0E > 0. Thus the statistic cannot be negative. It can equal 00 when every observed count exactly matches its expected count. Larger values indicate a greater overall discrepancy from the null model.

Visual guide 5: compare chi-square distribution shapes
Chi-square curves with different degrees of freedomThree theoretical chi-square density curves with degrees of freedom 2, 4 and 10. All panels use the same chi-square axis from zero to 30 and the same density scale from zero to 0.55. The df 2 curve falls from its maximum at zero; df 4 peaks at 2; df 10 peaks at 8. All have right tails, and right skew becomes less pronounced as degrees of freedom increase.
Posted on Google Google
0000003998 : Abdad Alam Shamim Alam profile picture
0000003998 : Abdad Alam Shamim Alam
Google star 1Google star 2Google star 3Google star 4Google star 5Trustindex verifies that the original source of the review is Google.
This is the bestest institution I have ever come to and I love it very much.
Posted on Google Google
Aliki S profile picture
Aliki S
Google star 1Google star 2Google star 3Google star 4Google star 5Trustindex verifies that the original source of the review is Google.
Posted on Google Google
Ali profile picture
Ali
Google star 1Google star 2Google star 3Google star 4Google star 5Trustindex verifies that the original source of the review is Google.
Sly is him
Posted on Google Google
Jitendra Kumar Kumawat profile picture
Jitendra Kumar Kumawat
Google star 1Google star 2Google star 3Google star 4Google star 5Trustindex verifies that the original source of the review is Google.
Posted on Google Google
Raahil Hasan profile picture
Raahil Hasan
Google star 1Google star 2Google star 3Google star 4Google star 5Trustindex verifies that the original source of the review is Google.
Posted on Google Google
Tina Mudarres profile picture
Tina Mudarres
Google star 1Google star 2Google star 3Google star 4Google star 5Trustindex verifies that the original source of the review is Google.
The classes are amazing and my child learnt so much
Posted on Google Google
alisha gadoya profile picture
alisha gadoya
Google star 1Google star 2Google star 3Google star 4Google star 5Trustindex verifies that the original source of the review is Google.
I have experienced a lot of good things, it has taught me so many things and from B/Cs I have gone to an A! This is wonderful and Mavish’s class is awesome.
Posted on Google Google
smasher 123 profile picture
smasher 123
Google star 1Google star 2Google star 3Google star 4Google star 5Trustindex verifies that the original source of the review is Google.
It’s sensational my kid went. First he only would get C now it’s all A’s really good and recommend
Posted on Google Google
Mosa Al- Samaraie profile picture
Mosa Al- Samaraie
Google star 1Google star 2Google star 3Google star 4Google star 5Trustindex verifies that the original source of the review is Google.
AMAZING PRICES GREAT TEACHERS STRAIGHT FORWARD LEARNING STEADY PACE IN TUTORING
Posted on Google Google
Cael Dagnelie profile picture
Cael Dagnelie
Google star 1Google star 2Google star 3Google star 4Google star 5Trustindex verifies that the original source of the review is Google.
I had a great experience learning math with Ms. Mavish. She explains complex topics in a very clear and simple way, which made it easier for me to understand and enjoy the subject. Her patience and dedication really stood out, and she always made sure that everyone in the class was keeping up. I especially appreciated how approachable she was — I never felt afraid to ask questions, and she was always willing to help. Thanks to her teaching, my confidence in math has grown a lot. I’m really thankful for the effort she puts into every lesson!

NUM8ERS is one of finest tutoring institutes in UAE, Located in Al Barsha 1, Dubai. Close to DUBAI AMERICAN ACADEMY (DAA) & AMERICAN SCHOOL OF DUBAI (ASD).