Contingency table

A contingency table is a table/matrix which shows the frequency of different combinations of two categorical variables.

They show the frequency of each combination - the number of times each combination occurs in the data. They don’t show the proportion or frequency.

Total rows/columns

We can add a row and column to show the total of the rows and columns in the table. That’s useful if we want to find a conditional probability from it, or to calculate the chi squared value.

The total rows and columns just show the total frequency of each category of the variables - the values in the rows and columns, all added up.

Example

Likes pelicansLikes axolotlsLikes parrots
Age < 1810515
Age 18-65201025
Age > 65+51510

The two categorical variables in this example are:

We can add up each row and column to find the row and column totals:

Likes pelicansLikes axolotlsLikes parrotsTotal
Age < 181051530
Age 18-6520102555
Age > 65+5151030
Total353050115

flashcards

QuestionAnswer
What is a contingency table?A table/matrix which shows the frequency of different combinations of two categorical variables.
What do contingency tables show?The frequency of each combination - the number of times each combination occurs in the data, not the proportion.
Why add total rows and columns to a contingency table?To find a conditional probability or to calculate the chi squared value.
How are total rows and columns calculated in a contingency table?The total shows the sum of frequencies for each category of the variables (values in rows and columns added up).
In the example contingency table, what are the two categorical variables?Age group (Age < 18, Age 18-65, Age > 65) and animal preference (Likes pelicans, Likes axolotls, Likes parrots).
What is the total frequency for Age < 18 in the example?30
What is the total frequency for “Likes axolotls” in the example?30
What is the overall total frequency in the example contingency table?115