A contingency table is a tabular representation of data which falls into several categories. It shows frequencies, or less frequently, probabilities, for particular combinations of values of two qualities or discrete random variables 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 restaurant customers. For each customer we have information on sex (variable X, taking on 2 possible values: "Male" or "Female") and preferred nationality of food(variable Y, taking on 3 possible values: "Indian", "Chinese", "French"). A contingency table for these data might look like the following
|
Indian |
Chinese |
French |
Total |
Male |
20 |
40 |
50 |
110 |
Female |
50 |
20 |
20 |
90 |
Total: |
70 |
60 |
70 |
200 |
This is a two-way 2x3 contingency table (i.e. two rows and three columns).
If there are any missing entries in the table we can usually fill them in from the remaining entries.
The row entries sum to the value in the totals column, so for the Male row,20+40+50=110 and for the Female row, 50+20+20=90.
The column entries sum to the entries in the values in the Totals Row. So for the Indian row, 20+50=70, for the Chinese column, 40+20=60 and for the French column, 50+20=70.
The total number of customers is 200, and we can find this in two ways:We can add the row totals:110+90=220 or we can add the column totals:70+60+70=200.
Suppose that a customer is picked at random.
What is the probability that this customer is a man?
Out of the 200 customers110 are men so the probability is 110/200=11/20.
If the customer went to a Chinese restaurant, what is the probability that they are female?
Of the 60 people who went to a Chinese Restaurant, 20 were female. The probability is 20/60=1/3.
Given that the customer is not Male, what is the probability they did not go to a French Restaurant?
If they are not Male, they are Female. Of the 90 Females, 70 did not go to a French Restaurant, so the probability is 70/90=7/9.