Unit 3 · Topic 3.15 · about 25 minutes
Carrying Out a Chi-Square Test for Homogeneity or Independence
Complete a chi-square test on a two-way table, from expected counts to a conclusion about the population or populations in context.
Predict first
In a randomized experiment, 300 adults with lower back pain are split into two groups: 120 get physical therapy and 180 get a home exercise sheet. After six weeks, 135 of the 300 adults report improvement. If the treatment made no difference, how many of the 120 physical therapy patients would you expect to improve?
Expected counts
The expected count for a cell is the count the null hypothesis predicts:
The reasoning is the one you just used. If is true, the overall split of the column variable should show up in every row, so each row gets its share of each column. Expected counts describe what happens on average, so they do not have to be whole numbers. Keep the decimals, because rounding expected counts changes the chi-square statistic.
The statistic, the degrees of freedom and the p-value
With the expected counts in hand, add up one piece per cell:
The sum runs over every cell of the table, and never over the totals. When is true, has a chi-square distribution with
The p-value is the area to the right of the observed under that distribution, found with a table or technology. Only the right tail counts, because only large values of mean the data sit far from what predicts.
| Treatment | Improved | Did not improve | Total |
|---|---|---|---|
| Physical therapy | 63 (54) | 57 (66) | 120 |
| Home exercise sheet | 72 (81) | 108 (99) | 180 |
| Total | 135 | 165 | 300 |
Every cell misses its expected count by 9, but the cells with smaller expected counts contribute more: , , and . That makes with , and the p-value is . At , that is convincing statistical evidence that the distribution of outcomes (improved or not) differs between the two treatments for adults like these.
| Age group | Card | Phone | Cash | Total |
|---|---|---|---|---|
| 18 to 34 | 53 | 37 | 10 | 100 |
| 35 to 54 | 77 | 30 | 13 | 120 |
| 55 and older | 70 | 13 | 17 | 100 |
| Total | 200 | 80 | 40 | 320 |
Worked exampleIs payment method associated with age?
A city's consumer affairs office selects a random sample of 320 adults who live in the city and records each person's age group and usual way of paying at a store. The results are in the table above. Do the data provide convincing statistical evidence, at , of an association between age group and usual payment method among adults in the city?
Name the test and state hypotheses. One random sample with two categorical variables calls for a chi-square test for independence. : there is no association between age group and usual payment method among adults in the city. : there is an association between age group and usual payment method among adults in the city.
Check conditions. Randomization: one random sample of the city's adults. 10%: 320 is far less than 10% of the adults in the city. Expected counts: the 18 to 34 row and the 55 and older row each have expected counts of 62.5, 25 and 12.5, and the 35 to 54 row has 75, 30 and 15. For example, card for ages 18 to 34 is . All expected counts are greater than 5.
Calculate. , with . The p-value is .
Conclude in context. Because , reject . There is convincing statistical evidence of an association between age group and usual payment method among adults in the city.
, , p-value about 0.0026: convincing evidence that payment method and age group are associated in this city.
Percent of each age group who usually pay with a phone
The phone column is where observed and expected counts differ most: the youngest group pays by phone far more often than predicts, and the oldest group far less.
What the p-value means, and what to say when it is large
The p-value is the probability of a chi-square statistic as large as the one observed, or larger, computed by assuming is true. In context: assuming there is no association between age group and payment method among the city's adults, there is about a 0.0026 probability of getting a chi-square statistic of 16.30 or larger in a random sample of 320 adults.
As with every test, compare the p-value with : reject if the p-value is less than or equal to , and fail to reject if it is greater. Here , and the result answers the question that started the study. Do payment habits differ by age in this city? The data give convincing evidence that they do.
A large p-value needs more careful wording. Suppose another city's survey gave a p-value of 0.31. Because , fail to reject : the data do not provide convincing statistical evidence of an association between age group and payment method among adults in that city. Saying the two variables are independent would be accepting , and a test can never establish that.
Check your understanding
A random sample of 250 students at a large high school was asked where they usually study.
For a chi-square test for independence, what is the expected count of students in grades 11 to 12 who usually study at the library?
A chi-square test for homogeneity compares the distribution of favorite movie type (action, comedy, drama, horror or animated) across three age groups. How many degrees of freedom does the test have?
A chi-square test for independence on a two-way table with 2 rows and 3 columns gives . What is the p-value?
Independent random samples of students at three high schools are asked their favorite of four music genres. A chi-square test for homogeneity gives with 6 degrees of freedom and a p-value of 0.027. Which is a correct interpretation of the p-value?
A random sample of 400 students at a university is classified by handedness and by preferred sport. A chi-square test for independence gives a p-value of 0.31. At , which conclusion is correct?
Course alignment, for teachers
AP Statistics topic 3.15, Unit 3: Inference for Categorical Data: Proportions.
- Skill 3.C: Calculate and estimate expected counts, percentages, probabilities, and intervals.
- Skill 3.E: Calculate appropriate statistical inference method results.
- Skill 4.F: Interpret results of statistical inference methods.
- Skill 4.G: Justify a claim based on statistical inference method results.