Expected Counts for
Chi-Square Tests
Master the expected count formula, learn the conditions required for valid chi-square inference, and build intuition through worked examples.
What Is a Chi-Square Test?
A chi-square test is a hypothesis test that compares observed counts (what you actually see in data) to expected counts (what you would predict under a null hypothesis). The bigger the gap between observed and expected, the stronger the evidence against \( H_0 \).
Observed vs. Expected Counts
Observed counts are the raw data you collect from a sample. Expected counts are the counts you would predict if the null hypothesis were true. The chi-square statistic measures how far observed counts deviate from expected counts.
Why Expected Counts Matter
The chi-square test statistic is built entirely from observed and expected counts. Without correctly computed expected counts, the test statistic is wrong and the p-value is meaningless. Expected counts also determine whether the chi-square approximation is valid.
Expected Counts: Goodness-of-Fit
Expected Counts: Two-Way Tables
GOF vs. Two-Way Expected Counts
| Goodness-of-Fit | Independence / Homogeneity | |
|---|---|---|
| Data structure | One-way frequency table | Two-way contingency table |
| Formula | \( E_i = n \cdot p_i \) | \( E = \frac{R \cdot C}{N} \) |
| Where \( p_i \) comes from | Stated in \( H_0 \) | Estimated from marginals |
| Degrees of freedom | \( k - 1 \) | \( (r-1)(c-1) \) |
Conditions for Valid Chi-Square
Step-by-Step: Computing Expected Counts
Example 1: Goodness-of-Fit
A candy company claims its bags contain equal proportions of 4 colors. You sample \( n = 200 \) candies and observe:
| Color | Red | Blue | Yellow | Green |
|---|---|---|---|---|
| Observed | 60 | 45 | 55 | 40 |
| Expected | 50 | 50 | 50 | 50 |
Example 1: Computing \( \chi^2 \)
With \( df = k - 1 = 4 - 1 = 3 \), we compare \( \chi^2 = 5.0 \) to the chi-square distribution. The p-value is approximately 0.172, so we fail to reject \( H_0 \) at \( \alpha = 0.05 \).
Example 2: Independence Test
A survey of 300 students asks about preferred study method and grade level. Is study preference independent of grade?
| Visual | Reading | Total | |
|---|---|---|---|
| Freshmen | 70 | 50 | 120 |
| Seniors | 90 | 90 | 180 |
| Total | 160 | 140 | 300 |
Example 2: Expected Counts
| Expected | Visual | Reading |
|---|---|---|
| Freshmen | \( \frac{120 \times 160}{300} = 64 \) | \( \frac{120 \times 140}{300} = 56 \) |
| Seniors | \( \frac{180 \times 160}{300} = 96 \) | \( \frac{180 \times 140}{300} = 84 \) |
Example 3: When Conditions Fail
A researcher surveys \( n = 20 \) people about 5 categories with claimed equal proportions. The expected count per cell is:
Common Mistakes
Summary: Chi-Square at a Glance
| Concept | Key Detail |
|---|---|
| GOF Expected Count | \( E_i = n \cdot p_i \) |
| Two-Way Expected Count | \( E = \frac{(\text{row total})(\text{col total})}{N} \) |
| Test Statistic | \( \chi^2 = \sum \frac{(O - E)^2}{E} \) |
| Large Counts Condition | All \( E_i \geq 5 \) |
| Random Condition | Random sample or randomized experiment |
| 10% Condition | \( n < 0.10 N \) (sampling without replacement) |
| GOF Degrees of Freedom | \( k - 1 \) |
| Two-Way Degrees of Freedom | \( (r - 1)(c - 1) \) |
Question 1 of 5
A die is rolled 60 times. Under \( H_0 \): the die is fair, what is the expected count for each face?
Question 2 of 5
In a two-way table, a cell has row total = 80, column total = 150, and grand total = 400. What is the expected count for that cell?
Question 3 of 5
Which condition states that all expected counts must be at least 5?
Question 4 of 5
A goodness-of-fit test has 5 categories and a sample of 100. Under \( H_0 \), the proportions are 0.40, 0.25, 0.20, 0.10, and 0.05. Which statement about the Large Counts condition is true?
Question 5 of 5
A \( 3 \times 4 \) contingency table is used for a chi-square test of independence. How many degrees of freedom does the test have?