A contingency table is a tabular representation of categorical data . A contingency table usually shows frequencies for particular combinations of values of two discrete random variable s X and Y. Each cell in the table represents a mutually exclusive combination of X-Y values.
For example, consider a sample of N=200 beer-drinkers. For each drinker we have information on sex (variable X, taking on 2 possible values: "Male" and "Female") and preferred category of beer (variable Y, taking on 3 possible values: "Light", "Regular", "Dark"). A contingency table for these data might look like the following
This is a two-way 2x3 contingency table (i.e. two rows and three columns).
Sometimes three-way (and more) contingency tables are used. Suppose the beer-drinkers data, besides sex and preference, are also stratified by age group. The third discrete variable Z ("Age") in this case might, for example, take on 4 values: "65".
In this case we would have a three-way 2x3x4 contingency table, equivalent to 4 two-way 2x3 contingency tables (one 2x3 table for each of the 4 age-groups).
See also: Contingency tables analysis