Degrees of freedom
If we have a contingency table with dimensions
v = (r - 1)(c - 1)
The degrees of freedom is the number of rows, minus one, all multiplied by the number of columns minus one.
How do we get this?
Let’s take this (very abstract) contingency table for example:
| Yes | No | Total | |
|---|---|---|---|
| A | 10 | 20 | 30 |
| B | 15 | 25 | 40 |
| C | 5 | 15 | 20 |
| Total | 30 | 60 | 90 |
We have
What is the maximum number of cells in the main body of the table (the cells with the numbers in them, but not the totals) can we completely remove, while still being able to find them from the rest of the table?
Here’s one example of the maximum number of cells we can remove:
| Yes | No | Total | |
|---|---|---|---|
| A | 10 | 30 | |
| B | 15 | 40 | |
| C | 20 | ||
| Total | 30 | 60 | 90 |
From just these
| Yes | No | Total | |
|---|---|---|---|
| A | 10 | 30 | |
| B | 15 | 40 | |
| C | 20 | ||
| Total |
Because the maximum number of cells we need to keep in order to retain all the data is
If we instead calculated the degrees of freedom using the formula, we would do