Carrying Out a Chi-Square Test for Homogeneity or Independence
Carrying out a chi-square test: find each expected count, add the components ((O − E)²)/E to get χ² , use the chi-square distribution with (r − 1)(c − 1) degrees of freedom for the right-tail p-value, compare it with α , and conclude about the association or the distributions in context.
Part 1 · Hook
Why this matters
Part 2 · Before you start
What this builds on
Part 3 · Prerequisite check
Quick check before you start
1. Row total 200, column total 90, grand total 300. What is the expected count?
Show the answer
.
- Correct: :
- :
- :
- :
2. A test gives a p-value of 0.016 at . The decision is
- reject
- fail to reject
- accept
- accept as proven
Show the answer
, so reject .
- Correct: reject :
- fail to reject :
- accept :
- accept as proven:
Part 4 · See it
See it first
Part 5 · Step by step
How it works, step by step
- For each cell, compare the observed count with the expected countthe term is that cell's contribution: large where the table departs from
- Add the terms over every cell, which is 0 when the table matches and grows as it departs
- If is true, follows a chi-square distribution with the p-value is the area to the right of the observed under that curve
- Compare the p-value with conclude about an association (or a difference in distributions) in context, then describe it from the largest terms
Part 6 · Key ideas
Key ideas
- over every cell; each term is a chi-square component.
- Degrees of freedom:
. - The p-value is always the right-tail area: only large values are evidence against .
- Conclude: "There is (is not) convincing evidence of an association between ... and ... for ..." (independence) or "that the distribution of ... differs among ..." (homogeneity).
Part 7 · Misconception
A common mistake
The wrong idea: The cell with the largest observed count contributes the most to .
What actually happens: What matters is the gap between observed and expected, relative to expected: . A big count close to its expected count adds almost nothing.
Part 8 · Check yourself
Check yourself
Exam-style questions. Anything you miss goes into your review queue.
Table
Phones in the bedroom and sleep
| Phone in bedroom | Under 7 hours | 7 to 8 hours | Over 8 hours | Total |
|---|---|---|---|---|
| Yes | 70 | 90 | 40 | 200 |
| No | 20 | 50 | 30 | 100 |
| Total | 90 | 140 | 70 | 300 |
1. What is the value of the chi-square statistic? Give two decimal places.
Type a number. A table answer and a calculator answer are both accepted.
Show the answer
Expected counts: 60, 93.3, 46.7 (yes) and 30, 46.7, 23.3 (no).
- Answer: 8.21
2. How many degrees of freedom does the test have?
Type a number. A table answer and a calculator answer are both accepted.
Show the answer
.
- Answer: 2
3. What is the p-value? Give four decimal places.
Type a number. A table answer and a calculator answer are both accepted.
Show the answer
with is 0.0165, the area in the right tail.
- Answer: 0.0165
4. State the conclusion of the test in context.
Write the conclusion in context.
Show the answer
Reject : convincing evidence of an association, in context, for the population sampled.
- A full-credit answer: Because the p-value of 0.0165 is less than 0.05, we reject the null hypothesis. There is convincing evidence of an association between keeping a phone in the bedroom and usual hours of sleep for students at the school.
5. Which cell contributes most to the chi-square statistic, and what does it show?
- No phone, under 7 hours: 20 observed, 30 expected
- Phone, 7 to 8 hours: the largest observed count in the table, 90
- Phone, under 7 hours: 70 observed against 60 expected
- No phone, over 8 hours: 30 observed against 23.3 expected
Show the answer
Each cell's term shows where the table departs most from .
- Correct: No phone, under 7 hours: 20 observed, 30 expected: Right: its term is , the largest of the six.
- Phone, 7 to 8 hours: the largest observed count in the table, 90: A large count is not the same as a large gap. Here 90 is close to the expected 93.3, a term of only 0.12.
- Phone, under 7 hours: 70 observed against 60 expected: This term is . The same gap of 10 counts for more where only 30 were expected.
- No phone, over 8 hours: 30 observed against 23.3 expected: This term is 1.90, second largest. The no phone, under 7 hours cell is larger.
6. In one cell of a two-way table, the observed count is 30 and the expected count is 22.4. Write the expression for this cell's contribution to , then give its value to two decimal places.
Type the expression as on the exam, with the values substituted.
Show the answer
- Answer:
7. A two-way table classifies students by class year (4 categories) and favorite lunch option (5 categories). How many degrees of freedom does a chi-square test for independence have?
- 19
- 7
- 20
- 12
Show the answer
.
- 19: That is the number of cells minus 1. Use .
- 7: That adds . Multiply instead.
- 20: That is the number of cells.
- Correct: 12: Right:
.
Part 9 · Summary
Summary
Part 10 · Up next
What comes next
Part 11 · Connections