Mistake Master
Student view — seeing the site as a student does
Home Unit 3 · Inference for Categorical Data: Proportions 3.1·3.2·3.3·3.4·3.5·3.6·3.7·3.8·3.9·3.10·3.11·3.12·3.13·3.14·3.15 Lesson
Skill Check 0 / 10 complete

How many populations were sampled?

One question decides which chi-square test a situation calls for, and it is a question about the sampling, not about the table: how many populations were sampled. Two or more separate groups, compared on one categorical variable, is homogeneity. One group, classified by two categorical variables, is independence. The arithmetic that follows is identical, which is exactly why the choice has to be made deliberately.

§1

Count the populations sampled, not the variables in the table.

Both tests run on a two-way table of counts and produce the same statistic. What separates them is the design:

  1. Homogeneity: independent random samples are drawn from two or more populations (or subjects are randomly assigned to several treatments), and each individual is classified on one categorical variable. The question is whether the distribution of that variable is the same across the groups.
  2. Independence: one random sample is drawn from a single population, and each individual is classified on two categorical variables. The question is whether those two variables are associated.

Surveying 200 students at each of three schools about a later start time is homogeneity: three populations, one variable. Surveying 550 students at one school and recording both their grade level and their answer is independence: one population, two variables.

The tell is in how the row totals arose. Under homogeneity they were fixed by the researcher, who chose the sample sizes. Under independence nothing was fixed except the single total, and the margins fell out of the data.

§2

The hypotheses are sentences, not equations.

Chi-square hypotheses are written in words, because the claim is about whole distributions rather than a single parameter:

  1. Homogeneity. $H_0$: the distribution of responses is the same for all three schools. $H_a$: the distribution of responses is not the same for all three schools.
  2. Independence. $H_0$: grade level and response are independent in the population of students at this school. $H_a$: grade level and response are associated in this population.

Two habits. Name the categorical variables and the population in every hypothesis, since "the distributions are the same" without a subject is not a claim. And keep the alternative broad: it says the distributions differ somewhere, and never specifies which group or which cell, which is a limit that returns in the next topic.

§3

Expected counts come from the margins.

Under the null, the best estimate of what each cell should hold is

$$\text{expected} = \frac{(\text{row total})(\text{column total})}{\text{grand total}}.$$

For the three-school table, with 120 and 80 at school A, 90 and 110 at school B, 66 and 84 at school C, the margins are 200, 200, 150 across the rows and 276, 274 down the columns, out of 550. School A's expected "yes" count is $\frac{200 \times 276}{550} \approx 100.4$, and its expected "no" count is $\frac{200 \times 274}{550} \approx 99.6$.

Expected counts are usually not whole numbers, and they should not be rounded: the statistic is sensitive to them. They also carry a built-in check, since each row of expected counts sums to that row's total and each column to that column's total.

§4

Feed it counts, and check the expected counts.

Two conditions, and each has a standard way of going wrong.

The data must be counts. A chi-square statistic compares observed with expected frequencies. Running it on a table of percentages produces a number with no meaning, because the statistic depends on how many individuals produced those percentages: 60% out of 10 people and 60% out of 1,000 are not the same evidence. If a table gives percentages and a total, convert back to counts first.

All expected counts must be at least 5. Note which counts: the expected ones, computed from the margins, not the observed ones. A cell with an observed count of 2 is fine if its expected count is 8; a cell with an observed count of 12 is a problem if its expected count is 3.

The random condition applies as always: independent random samples for homogeneity, one random sample for independence, with the usual 10% condition when sampling without replacement.

Finally, the degrees of freedom come from the table's shape, never from the sample size:

$$df = (\text{number of rows} - 1)(\text{number of columns} - 1).$$

A 3-by-2 table has $df = (3-1)(2-1) = 2$, whether it holds 55 individuals or 55,000.

§5

Skill Check.

Ten scenarios. Pick the chips that match your answer, then check. A scenario marks complete the first time every part is right. Progress saves on this device.

0 of 10 scenarios complete