TOPICS
Search

Contingency Table


A contingency table, sometimes called a two-way frequency table, is a tabular mechanism with at least two rows and two columns used in statistics to present categorical data in terms of frequency counts. More precisely, an r×c contingency table shows the observed frequency of two variables, the observed frequencies of which are arranged into r rows and c columns. The intersection of a row and a column of a contingency table is called a cell.

gendercupconesundaesandwichother
male5923002042480
female4103351802055

For example, the above contingency table has two rows and five columns (not counting header rows/columns) and shows the results of a random sample of 2200 adults classified by two variables, namely gender and favorite way to eat ice cream (Larson and Farber 2014). One benefit of having data presented in a contingency table is that it allows one to more easily perform basic probability calculations, a feat made easier still by augmenting a summary row and column to the table.

gendercupconesundaesandwichothertotal
male59230020424801200
female41033518020551000
total1002635384441352200

The above table is an extended version of the first table obtained by adding a summary row and column. These summaries allow easier computation of several different probability-related quantities. For example, there's a 1002/2200 approx 45.54% probability that the person sampled prefers their ice cream in a cup, while the probability that a random participant is female is 1000/2200 approx 45.45%. What's more, computing conditional probabilities is made easier using contingency tables, e.g., the probability that a person prefers ice cream sandwiches given that the person is male is 24/1200=2%, while the conditional probability that a person is male given that ice cream sandwiches are preferred is 24/44 approx 54.54%.

Other common statistical analyses can be performed on data given in contingency table form. For example, one useful value to know is the so-called expected frequency E_(c,r) of the cell at the intersection of column c and row r, the formula for which is given by

 E_(c,r)=((sum of row r)·(sum of column c))/(sample size).
(1)

Computing E_(1,1) says that the value one would expect at cell (1,1)--i.e., the expected number of men who prefer to eat ice cream from a cup--is approximately

 E_(1,1)=(1200·1002)/(2200) approx 546.54,
(2)

whereby one may deduce that there are somehow "more than expected" of that particular demographic included in the given sample. Note, too, that knowing E_(1,1) automatically gives, e.g., E_(2,1), without repeated application of ():

 E_(2,1)=(total people who prefer cups)-E_(1,1) approx 1002-546.54=455.46.
(3)

One of the major benefits of computing expected frequencies is the ability to test whether the two variables being examined--in this case, gender and favorite way to eat ice cream--are actually independent as they've been assumed throughout. This is done by computing, for each cell (c,r), the expected frequency E=E_(c,r), comparing it to the observed frequency O=O_(c,r), and then performing a chi-squared test.

Another common test associated to contingency tables is so-called homogeneity of proportions test which is a form of chi-squared test used to determine whether several proportions are equal when samples are taken from different populations (Larson and Farber 2014). Worth noting is that both of the above-mentioned instances of chi-squared testing requires a randomly-selected sampling of observed frequencies, each of whose expected frequency is at least 5. These tests play important roles throughout various branches of statistics.


See also

Categorical Variable, Chi-Squared Test, Conditional Probability, Frequency Distribution, Independent Events, Probability, Sample, Statistics, Variable

This entry contributed by Christopher Stover

Explore with Wolfram|Alpha

References

Larson, R. and Farber, B. Elementary Statistics: Picturing the World, 6th ed. Indianapolis: Pearson Higher Education, 2014.Triola, M. F. Elementary Statistics, 11th ed. Boston: Addison-Wesley, 2011.

Cite this as:

Stover, Christopher. "Contingency Table." From MathWorld--A Wolfram Web Resource, created by Eric W. Weisstein. https://mathworld.wolfram.com/ContingencyTable.html

Subject classifications