01 / 20

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.

College Statistics

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 \).

Goodness-of-Fit
Does one categorical variable match a claimed distribution?
Independence
Are two categorical variables independent of each other?
Homogeneity
Do different populations share the same distribution?

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.

Observed A 45 B 30 C 25 Expected A 33.3 B 33.3 C 33.3

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

1
Identify the total sample size \( n \): the sum of all observed counts.
2
Determine each \( p_i \): the proportion claimed by \( H_0 \) for each category.
3
Multiply: \( E_i = n \cdot p_i \) for every category.

Expected Counts: Two-Way Tables

Col 1 Col 2 Row 1 a b Row 2 c d Totals a+c b+d
\( E(\text{cell a}) = \frac{(a+b)(a+c)}{a+b+c+d} \)

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

1
Random: Data must come from a random sample or randomized experiment.
2
Independence (10% rule): When sampling without replacement, sample size must be < 10% of the population: \( n < 0.10 N \).
3
Large Counts: All expected counts must be at least 5: \( E_i \geq 5 \) for every cell.

Step-by-Step: Computing Expected Counts

1
Identify the test type: Is it goodness-of-fit (one variable) or independence/homogeneity (two variables)?
2
Write the null hypothesis: This determines the proportions or the assumption of independence.
3
Compute expected counts: Use \( E_i = np_i \) (GOF) or \( E = \frac{R \cdot C}{N} \) (two-way).
4
Check Large Counts: Verify every \( E_i \geq 5 \). If not, consider combining categories or using an exact test.
5
Compute the test statistic: \( \chi^2 = \sum \frac{(O_i - E_i)^2}{E_i} \) and find the p-value.

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:

Option A
Combine categories to increase expected counts above 5.
Option B
Collect a larger sample so each \( E_i \geq 5 \).
Option C
Use Fisher's exact test or a simulation-based approach.

Common Mistakes

✕ Checking Observed Counts
The Large Counts condition applies to expected counts, not observed counts. Don't check if observed values are \( \geq 5 \).
✕ Wrong Formula for Test Type
Using \( E = np_i \) for a two-way table, or \( \frac{R \cdot C}{N} \) for a goodness-of-fit test. Match the formula to the test.
✕ Forgetting the 10% Rule
The independence condition (\( n < 0.10N \)) must be checked when sampling without replacement. It's separate from Large Counts.

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?