Expected Counts in Two-Way Tables
Expected counts in a table
- For a two-way table, each cell has its own expected count under the null of "no relationship."
- The formula:
-
$$\text{expected} = \frac{(\text{row total})(\text{column total})}{\text{grand total}}$$
- Compute it separately for every cell.
Why that formula?
- Under the null, the two variables are unrelated — the column split is the same in every row.
- So a cell's expected count = (that row's total) $\times$ (that column's overall fraction).
- That column fraction is $\dfrac{\text{column total}}{\text{grand total}}$.
- Multiply out and you get the row$\times$column$\div$grand-total formula.
Check every cell
- The large counts condition applies to every cell's expected count $\ge 5$.
- Not the observed counts, and not just some cells — all of them.
- One small expected cell can invalidate the whole test.
- Compute the full table of expected counts and scan it.
Degrees of freedom
- For a two-way table, $df = (\text{rows} - 1)(\text{columns} - 1)$.
- A $2 \times 3$ table → $df = (2-1)(3-1) = 2$.
- It counts the "free" cells once the margins are fixed.
- It depends on the table's shape, not the sample size.
Expected counts in a two-way table
Compute the count you would expect in a cell if the two variables were independent.
Two-way $df$ is $(\text{rows}-1)(\text{columns}-1)$, a product — not (cells $-1$). A $2\times2$ table has $df=1$, not $3$. And the expected-count formula uses row total $\times$ column total $\div$ grand total for each cell; mixing up which totals go on top is the usual error. Check every expected count $\ge 5$.
A $2\times2$ table: row totals $60, 40$; column totals $50, 50$; grand total $100$.
- Expected for the top-left cell: $\dfrac{60 \times 50}{100} = 30$.
- Repeat for all four cells: $30, 30, 20, 20$ — all $\ge 5$ ✓.
- $df$: $(2-1)(2-1) = 1$.
In a two-way table, each cell's expected count $= \frac{(\text{row total})(\text{column total})}{\text{grand total}}$ (from the null of no relationship). Check that every expected count is $\ge 5$. The degrees of freedom are $(\text{rows} - 1)(\text{columns} - 1)$.
Row total 60, column total 50, grand total 100. Find the expected count (row·col/grand).
60 × 50 / 100 = 30.
For a 2×3 two-way table, what are the degrees of freedom (r−1)(c−1)?
(2−1)(3−1) = 1×2 = 2.
For a 2×2 two-way table, what are the degrees of freedom?
(2−1)(2−1) = 1.
The large counts condition for a two-way table requires...
All expected cells must be at least 5.
The degrees of freedom for a two-way table are the number of cells minus 1.
It's (rows−1)(columns−1), a product.