Using Contingency Tables for Probability and Dependence

Example of Using a Contingency Table to Determine Probability

Step 1: Understanding what the Table is Telling you:

The following Contingency Table shows the number of Females and Males who each have a given eye color. Note that, for example, the table show that 20 Females have Black eyes and that 10 Males have Gray eyes. Also notice that the Table shows the totals. We have 85 Females in the dataset. We have 82 Males in the dataset. We have a total of 167 People in the dataset. Finally, this table also shows the totals for eye color. For example, 45 People have Black eyes.

EyeColorContTable

Before you move forward, make sure that you understand how to read the Contingency Table.

 

Example Questions:

1)      Given this Contingency Table, what is the Probability that a randomly selected person will have Black eyes?

Answer:

The Table shows us that 45 People have Black eyes out of the total 167 people who were part of this data.

Therefore, P(Person having Black eyes ) = 45/167 = .27 (or 27%)

2)      Given this Contingency Table, what is the Probability that a randomly selected Female will have Black eyes? In other words, what is the probability of a person having black eyes GIVEN that they are female?

Answer:

The Table shows us that 20 Females have black eyes out of the 85 total females in the dataset.

P( black eyes | female ) = 20/85 = .235 or 23.5%

The above states that the probability of a person having black eye GIVEN that they are female is 20/85.

blackGivenFemale

3)      Given this Contingency Table, what is the Probability that a randomly selected person will have Blue eyes OR will be Male?

Answer:

This question deals with a probability concept called the “OR”. There is a formula for OR that is:

P(A OR B) = P(A) + P(B) – P(A AND B)

In this example, we are looking at two things: we are looking at BLUE EYES and MALE

So, the question asked is:

P( Blue eyes OR Male) = P(Blue eyes) + P( Male) – P(Blue eyes AND Male)

Using the Table, we see that

P(Blue eyes) = 22/167

probBlue

P( Male) = 82/167

probMale

P( Blue eyes AND Male) = 12/167

blueAndMale

Therefore:

P( Blue eyes OR Male) = P(Blue eyes) + P( Male) – P(Blue eyes AND Male)

= 22/167 + 82/167 – 12/167 = (22 + 82 – 12) / 167 = 92/167 = .55 or 55%

Common Question: Why do we subtract the probability of Male and blue eyes? The answer is that when we count up all the males and then we count up all the people with blue eyes, there is some overlap because some males have blue eyes. This means we counted them twice and so we have to subtract the extra count.

 

4)      Using the Contingency Table, what is the probability of selecting a Female AND a Gray eye person?

Answer

The question here is asking for P(Female AND Gray eyes)

The AND also has a formula:

P(A AND B) = P(A | B) * P(B)

 

NOTE: This is read as probability of A GIVEN B times the probability of B. When A and B are INDEPENDENT then P(A AND B) = P(A | B) * P(B) = P(A) * P(B)

 

Here:

P(Female | Gray eyes) = 10/20

Why? If you know that the person has Gray eye (given gray tells you this) then 10 of the 20 gray eyed people are female.

P(Gray eyes) = 20/167

 

Therefore:

P(Female AND Gray eyes) = P(Female | Gray eyes) * P(Gray eyes) = 10/20 * 20/167 = .5 * .12 = .06 or about 6%.

 

You can also do this directly from the table without the formula:

P( Female AND Gray eyes) = 10/167 = .06 or about 6%

grayANDfemale

The two answers are identical and just two ways to solve the question.

 

5)      Using the Contingency Table, determine if being Male and having Green eyes are INDEPENDENT?

To prove that two variables (say A and B) are independent, we must show that

P( A AND B) = P(A | B) * P(B) = P(A) * P(B)

First, from the Contingency Table:

P(A AND B) is P( Male AND Green eyes) = 20/167

 

P(A) = P(Male) = 82/167

P(B) = P(Green eyes) = 35/167

P(A | B) = P(Male GIVEN Green eyes) = 20/35

probMaleGivenGreen

OK- now we have everything we need to check for independence:

P( A AND B) = P(A | B) * P(B) = P(A) * P(B)

20/167 =? 20/35 * 35/167 =? 82/167* 35/167

.1197   =?   .5714 * .2095 =?   .4910 * .2095

.1197  =?    .1197   =?   .1028

So NO these are NOT independent.