10.5 Comparison of the Chi-Square Tests
SLO 4
Demonstrate an understanding of, and ability to use, basic ideas of statistical processes, including hypothesis tests and confidence interval estimation.
SLO 5
Identify appropriate statistical techniques and use technology-based statistical analysis to describe, interpret, and communicate results.
Learning Objectives
By the end of this section, you will be able to:
- state which of the three chi-square tests a given research question calls for;
- write the null and alternative hypotheses for each of the three tests;
- distinguish the three designs by counting how many populations were sampled and how many questions were asked;
- explain why the same test statistic can answer three different questions.
You have seen the \(\chi^{2}\) test statistic used in three different circumstances. Every one of them summed \(\frac{(O-E)^{2}}{E}\) across a set of cells, compared the result to a right-tailed chi-square curve, and rejected when the total got too large. The arithmetic never changed. What changed was the design of the study that produced the table, and that is what decides which test you are running and what your conclusion is allowed to say. This section is a summary that will help you decide which \(\chi^{2}\) test is the appropriate one to use.
10.5.1 Three Tests, One Statistic
The three tests differ in exactly two features of the study behind them: how many populations were sampled, and how many questions were asked of each subject. Answer those two questions and the test names itself.
| Test | Populations sampled | Questions asked | Decides |
|---|---|---|---|
| Goodness-of-fit | one | one | whether the population fits a KNOWN distribution |
| Independence | one | two | whether the two variables are related |
| Homogeneity | two | one | whether the two populations match each other |
One population and one question gives goodness-of-fit; one population and two questions gives independence; two populations and one question gives homogeneity. There is no test here for two populations and two questions, and that is not an oversight — that design asks two questions at once and needs to be split before any of these tools apply. The table is complete because these three cover every case the chapter's single statistic can settle.
For each study, count the populations sampled and the questions asked, then name the test.
a. A researcher surveys 500 voters, recording each one's party affiliation and their opinion on a ballot measure.
b. A researcher surveys 300 first-year students and 300 fourth-year students, recording each one's preferred study location.
c. A researcher rolls a die 600 times and records which face came up, to see whether the die is fair.
Solution — counting populations and questions
Step 1 — Analyze study a. One population was sampled: 500 voters. Two things were recorded about each person: party affiliation and opinion. One population, two questions.
Step 2 — Name test a. This is a test of independence.
Step 3 — Analyze study b. Two populations were sampled separately, first-year and fourth-year students, with sample sizes chosen by the researcher. One thing was recorded: preferred study location.
Step 4 — Name test b. This is a test for homogeneity.
Step 5 — Analyze study c. One population was sampled — 600 rolls — and one thing was recorded, the face. A known distribution is being tested against: a fair die gives each face one-sixth of the time.
Step 6 — Name test c. This is a goodness-of-fit test.
Answer: (a) independence, (b) homogeneity, (c) goodness-of-fit.
10.5.2 Goodness-of-Fit
Use the goodness-of-fit test to decide whether a population with an unknown distribution "fits" a known distribution. In this case there will be a single qualitative survey question or a single outcome of an experiment from a single population.
Goodness-of-fit is typically used to see if the population is uniform (all outcomes occur with equal frequency), the population is normal, or the population is the same as another population with a known distribution.
The null and alternative hypotheses are:
\(H_{0}\): The population fits the given distribution.
\(H_{a}\): The population does not fit the given distribution.
The distribution has to arrive from outside the data — a published national percentage, the uniform distribution implied by "equally likely", the sample space of two fair coins. If nobody can tell you what the expected counts should be without looking at your data first, this is not a goodness-of-fit test.
A nutritionist claims that 40% of a city's residents eat fast food weekly, 35% monthly, and 25% rarely. A sample of 500 residents is surveyed. Name the test, write the hypotheses, give the expected counts, and state the degrees of freedom.
Solution — a known distribution and one population
Step 1 — Count populations and questions. One population, city residents; one question, how often they eat fast food. A distribution is given in advance.
Step 2 — Name the test. Goodness-of-fit.
Step 3 — Write the hypotheses.
\(H_{0}\): The population fits the given distribution (40% weekly, 35% monthly, 25% rarely).
\(H_{a}\): The population does not fit the given distribution.
Step 4 — Build the expected counts. Multiply each percentage by 500:
$$ (0.40)(500) = 200 \qquad (0.35)(500) = 175 \qquad (0.25)(500) = 125 $$Step 5 — Find the degrees of freedom. There are three categories, so \(df = 3 - 1 = 2\).
Answer: A goodness-of-fit test with expected counts 200, 175 and 125, and \(df = 2\).
A campus dining hall offers four entrées and wants to know whether students choose among them equally often. A random sample of 240 meal selections is recorded. Name the test, write the hypotheses, and give the expected counts and degrees of freedom.
Solution — "equally often" supplies the distribution
Step 1 — Count populations and questions. One population, meal selections; one question, which entrée.
Step 2 — Find the given distribution. "Equally often" means the uniform distribution — testing for uniformity is one of the standard uses of this test.
Step 3 — Name the test and write the hypotheses. Goodness-of-fit.
\(H_{0}\): The population fits the given distribution — the four entrées are chosen with equal frequency.
\(H_{a}\): The population does not fit the given distribution.
Step 4 — Build the expected counts.
$$ E = \frac{240}{4} = 60 \text{ for each entrée} $$Step 5 — Find the degrees of freedom. \(df = 4 - 1 = 3\).
Answer: A goodness-of-fit test for uniformity, with an expected count of 60 for each entrée and \(df = 3\).
10.5.3 Independence
Use the test for independence to decide whether two variables (factors) are independent or dependent. In this case there will be two qualitative survey questions or experiments and a contingency table will be constructed. The goal is to see if the two variables are unrelated (independent) or related (dependent).
The null and alternative hypotheses are:
\(H_{0}\): The two variables (factors) are independent.
\(H_{a}\): The two variables (factors) are dependent.
A hospital samples 800 patients and records, for each, whether they received a flu shot and whether they were hospitalized that winter. Name the test, write the hypotheses, and give the degrees of freedom.
Solution — one sample, two questions
Step 1 — Count populations and questions. One population was sampled, 800 patients, and two things were recorded about each: flu shot, yes or no, and hospitalized, yes or no.
Step 2 — Name the test. One population and two questions makes this a test of independence, and the data form a contingency table.
Step 3 — Write the hypotheses.
\(H_{0}\): Receiving a flu shot and being hospitalized are independent.
\(H_{a}\): Receiving a flu shot and being hospitalized are dependent.
Step 4 — Find the degrees of freedom. The table is 2 rows by 2 columns.
$$ df = (\text{rows} - 1)(\text{columns} - 1) = (2-1)(2-1) = 1 $$Answer: A test of independence with \(df = 1\).
A college surveys 400 students, recording each student's major area (arts, sciences, business) and whether they work part time. Name the test, write the hypotheses, and give the degrees of freedom.
Solution — recognizing a contingency table
Step 1 — Count populations and questions. One population, 400 students; two questions, major area and part-time work.
Step 2 — Name the test. A test of independence. The 3-by-2 grid of counts is a contingency table.
Step 3 — Write the hypotheses.
\(H_{0}\): Major area and working part time are independent.
\(H_{a}\): Major area and working part time are dependent.
Step 4 — Find the degrees of freedom. Three major areas and two work categories:
$$ df = (3 - 1)(2 - 1) = (2)(1) = 2 $$Answer: A test of independence with \(df = 2\).
10.5.4 Homogeneity
Use the test for homogeneity to decide if two populations with unknown distributions have the same distribution as each other. In this case there will be a single qualitative survey question or experiment given to two different populations.
The null and alternative hypotheses are:
\(H_{0}\): The two populations follow the same distribution.
\(H_{a}\): The two populations have different distributions.
Goodness-of-fit needs a distribution supplied in advance. Homogeneity has none — neither population's distribution is known, and neither is treated as the standard. That symmetry is the reason the conclusion can only ever be "the same" or "not the same", never "this group is higher".
A market researcher asks 250 urban shoppers and 250 suburban shoppers which of six store departments they visit most often. Name the test, write the hypotheses, and give the degrees of freedom.
Solution — two populations, one question
Step 1 — Count populations and questions. Two populations were sampled separately, urban and suburban shoppers, with the researcher fixing both sample sizes at 250. One question was asked.
Step 2 — Name the test. A test for homogeneity.
Step 3 — Write the hypotheses.
\(H_{0}\): Urban and suburban shoppers follow the same distribution of most-visited department.
\(H_{a}\): Urban and suburban shoppers have different distributions.
Step 4 — Find the degrees of freedom. Six departments:
$$ df = \text{number of columns} - 1 = 6 - 1 = 5 $$Answer: A test for homogeneity with \(df = 5\).
A researcher gives the same five-option survey question to 180 employees at one branch and 220 employees at another. Name the test, write the hypotheses, and give the degrees of freedom.
Solution — unequal sample sizes are not a problem
Step 1 — Count populations and questions. Two populations sampled separately, one question each. The unequal sizes, 180 and 220, do not matter — homogeneity compares shares within each row, not raw totals.
Step 2 — Name the test. A test for homogeneity.
Step 3 — Write the hypotheses.
\(H_{0}\): The two branches follow the same distribution of responses.
\(H_{a}\): The two branches have different distributions.
Step 4 — Find the degrees of freedom. Five response options:
$$ df = 5 - 1 = 4 $$Answer: A test for homogeneity with \(df = 4\).
10.5.5 Choosing Between Them
The two tests students most often confuse are independence and homogeneity, because both produce a rectangular table and both compute the identical statistic from it. The tables look the same on the page; the studies behind them do not.
| Test of independence | Test for homogeneity | |
|---|---|---|
| Samples drawn | one | two |
| Who fixes the row totals | the data | the researcher |
| Recorded per subject | two characteristics | one characteristic |
| \(H_{0}\) says | the two factors are independent | the two populations follow the same distribution |
| \(df\) | \((r-1)(c-1)\) | \(c - 1\) |
The row-total question is the fastest tiebreaker. If the researcher decided in advance how many subjects would be in each row — 250 men and 300 women, 100 families and 200 singles — the rows are a design choice and the test is homogeneity. If the row totals only became known after the data came in, they are a result and the test is independence.
A study samples 550 households and records both the number of vehicles owned and whether the household is urban or rural. A second study samples 275 urban households and 275 rural households and records the number of vehicles owned by each. Both produce a table with the same rows and columns. Name each test and explain which single feature separates them.
Solution — who fixed the row totals
Step 1 — Examine the first study. One sample of 550 households was drawn, and two characteristics were recorded for each: vehicle count and urban/rural status. Nobody decided in advance how many would be urban — that came out of the data.
Step 2 — Name the first test. A test of independence, with \(H_{0}\) that vehicle count and urban/rural status are independent.
Step 3 — Examine the second study. Two samples were drawn separately, and the researcher fixed both row totals at 275. One characteristic was recorded.
Step 4 — Name the second test. A test for homogeneity, with \(H_{0}\) that urban and rural households follow the same distribution of vehicle counts.
Step 5 — Identify the separating feature. Both tables have identical shapes and would yield identical arithmetic. What separates them is whether the row totals were chosen by the researcher or produced by the data.
Answer: The first is a test of independence and the second a test for homogeneity. The single distinguishing feature is who fixed the row totals — the design or the data.
Problem Set 10.5
Problem 1. State the null and alternative hypotheses for a goodness-of-fit test.
Solution
Step 1 — Recall the role of the hypotheses in a goodness-of-fit test: the test compares one population against a distribution given in advance, so the null hypothesis asserts agreement with that known distribution.
Step 2 — State the hypotheses:
\(H_{0}\): The population fits the given distribution.
\(H_{a}\): The population does not fit the given distribution.
Answer: \(H_{0}\): the population fits the given distribution; \(H_{a}\): the population does not fit the given distribution.
Problem 2. State the null and alternative hypotheses for a test of independence.
Solution
Step 1 — Recall the design behind a test of independence: one population is sampled and two variables are recorded for each subject, arranged in a contingency table.
Step 2 — State the hypotheses:
\(H_{0}\): The two variables (factors) are independent.
\(H_{a}\): The two variables (factors) are dependent.
Answer: \(H_{0}\): the two variables are independent; \(H_{a}\): the two variables are dependent.
Problem 3. State the null and alternative hypotheses for a test for homogeneity.
Solution
Step 1 — Recall the design behind a test for homogeneity: two populations are sampled separately, each asked a single question, and neither population's distribution is known in advance.
Step 2 — State the hypotheses:
\(H_{0}\): The two populations follow the same distribution.
\(H_{a}\): The two populations have different distributions.
Answer: \(H_{0}\): the two populations follow the same distribution; \(H_{a}\): the two populations have different distributions.
Problem 4. Name the two features of a study's design that together determine which chi-square test applies.
Solution
Step 1 — Identify the first feature: how many populations were sampled (one or two).
Step 2 — Identify the second feature: how many questions were asked of each subject (one or two).
Step 3 — See how they combine. One population with one question gives goodness-of-fit; one population with two questions gives independence; two populations with one question gives homogeneity.
Answer: The number of populations sampled and the number of questions asked of each subject together determine which chi-square test applies.
Problem 5. A researcher samples 900 people and records their blood type, to test against published national percentages. Name the test.
Solution
Step 1 — Count populations and questions. One population was sampled (900 people), and one question was asked of each (blood type).
Step 2 — Check whether a distribution is supplied. Published national percentages provide the expected counts without looking at the sample data, which is exactly what goodness-of-fit requires.
Answer: A goodness-of-fit test.
Problem 6. A researcher samples 200 men and 200 women and asks each a single question with four possible answers. Name the test.
Solution
Step 1 — Count populations and questions. Two populations were sampled separately — 200 men and 200 women, with both row totals fixed by the researcher — and one question with four possible answers was asked.
Step 2 — Match to the design table. Two populations and one question names the test.
Answer: A test for homogeneity.
Problem 7. A researcher samples 400 people and records both their exercise frequency and their sleep quality. Name the test.
Solution
Step 1 — Count populations and questions. One population was sampled (400 people), and two characteristics were recorded about each person: exercise frequency and sleep quality.
Step 2 — Match to the design table. One population and two questions means the data form a contingency table testing a relationship between the factors.
Answer: A test of independence.
Problem 8. Explain why the test for homogeneity cannot conclude that one population favors a particular category more than the other does.
Solution
Step 1 — Note what the hypotheses allow. The null says the two populations follow the same distribution and the alternative says they have different distributions — there is no hypothesis about which population is higher on any category.
Step 2 — Explain why. Neither population's distribution is known in advance, so neither serves as a standard against which the other can be measured. The comparison is symmetric: it can only detect sameness or difference, not direction.
Answer: Because neither distribution is specified in advance, the test's hypotheses only assert "same" versus "different" distributions; there is no reference distribution to declare one population higher than the other on any category.
Problem 9. A student says a test of independence and a test for homogeneity are the same test because the arithmetic is identical. Explain what is right and what is wrong about that claim.
Solution
Step 1 — Acknowledge what is right. Both tests build a rectangular contingency-style table, compute the identical statistic \(\sum \frac{(O-E)^{2}}{E}\), and compare it to the same right-tailed chi-square curve — so the arithmetic really is identical.
Step 2 — Identify what is wrong. The tests answer different questions because the studies behind them differ. Independence samples one population and records two characteristics per subject (\(H_{0}\): the factors are independent); homogeneity samples two populations separately and records one characteristic (\(H_{0}\): the populations share the same distribution). In independence the data determine the row totals; in homogeneity the researcher fixes them in advance.
Step 3 — Draw the conclusion allowed. Because the designs differ, the conclusions differ too: "the variables are related" versus "the populations match."
Answer: The student is right that the arithmetic is identical, but wrong that the tests are the same — they come from different study designs (one population/two questions vs. two populations/one question) and therefore support different hypotheses and different conclusions.
Problem 10. Give a research question of your own for each of the three tests, and say in one sentence why each one matches.
Solution
Step 1 — Goodness-of-fit question. "Do visitors to a museum arrive on weekdays in the proportions 20%, 20%, 15%, 15%, 30% claimed by management?" This matches because one population is sampled, one question is asked, and a specific distribution is given in advance.
Step 2 — Independence question. "Among students at one college, is participation in campus clubs related to whether a student lives on campus?" This matches because one population is sampled and two characteristics are recorded for each student, forming a contingency table.
Step 3 — Homogeneity question. "Do commuters from two different cities show the same distribution of transportation modes (car, bus, bike, walk)?" This matches because two populations are sampled separately, one question is asked of each, and neither city's distribution is known beforehand.
Answer: Goodness-of-fit: weekday arrival proportions vs. a claimed distribution (one population, one question, known distribution). Independence: club membership vs. living situation among students (one population, two questions). Homogeneity: transportation-mode distributions across two cities (two populations, one question).
Key Terms
goodness-of-fit test — decides whether one population with an unknown distribution fits a distribution given in advance; one population, one question.
test of independence — decides whether two variables recorded on one sampled population are independent or dependent; one population, two questions, arranged in a contingency table.
test for homogeneity — decides whether two populations with unknown distributions follow the same distribution as each other; two populations, one question.
contingency table — the rectangular table of counts built when two qualitative questions are asked of the same sample.
given distribution — the externally supplied distribution a goodness-of-fit test compares against, such as a uniform distribution, a normal distribution, or a published set of population percentages.