A contingency table is a type of table that is used to display the relationship between two categorical variables. Categorical variables are variables that can take on a limited number of values, each of which represents a category. For example, a categorical variable might represent the gender of a person (male or female) or the type of car that a person owns (sedan, SUV, or truck).
In a contingency table, the rows of the table represent one categorical variable, and the columns represent the other. Each cell in the table represents the number of observations that fall into a particular combination of categories. For example, if we are studying the relationship between the type of car that a person owns and their gender, we might create a contingency table with rows representing the type of car (sedan, SUV, or truck) and columns representing gender (male or female). Each cell in the table would represent the number of people who own a particular type of car and are a particular gender.
Contingency tables are often used to analyze the relationship between two categorical variables and to test whether there is a significant association between the variables. This can be done using statistical tests, such as the chi-square test.
See also: Heat map, Tree map, Confusion matrix