The simplest test we can apply to a table is independence: a
null hypothesis of no association:
Pearson's test.
For more detailed patterns of association, or higher
dimensional tables we need a more general tool:
Loglinear models.
A loglinear model is a generalised linear model
which estimates the cell counts of a table using different
combinations of the `margins'.
In a two-way table the margins are the row and column
totals.
In higher dimensional tables, the margins are the
sub-tables of lower dimension: e.g., in an A*B*C table, the A*B,
A*C and B*C tables (and indeed the A, B and C one-way frequency
distributions) are the margins.