Conditional Probability

In a study of heart disease in male federal employees, researchers classified 356 volunteer subjects according to their socioeconomic status (SES - coded as Low, Middle, High) and their smoking status (Smoking - coded as Never, Former and Current). Here is the data:

What is the probability that a randomly selected volunteer in this study is a former smoker with a high socioeconomic status?
Answer is easy (92/356) but let's do this slowly:
Event A = "Former Smoker"
Event B = "high socioeconomic status"

What is the probability that a randomly selected volunteer in this study is a former smoker ?

If we know that a randomly selected volunteer is a former smoker, what is the probability that he also has a high socioeconomic status?
Again the answer is clear: 92/141
This kind of probability is called a conditional probability. We use the notation P(high|former) = P(B|A). Note:

In general we can find conditional probabilities using the formula

Note: this only works if P(B)>0

Example: Say we draw a card from a standard deck. The values of the card are 2,3, .. , 10 for the "number" cards, 10 for Jack, Queen, King and 11 for the Ace. We draw cards until we have a point total of at least 17. Use simulation to find the the probability that 3 or more cards are drawn.
The simulation is done in the R function cards.

Say your first card is a 7. On average, how many cards are you going to draw now?
This is a conditional probability, namely P(3 or more cards drawn | first card is a "7"). We can find this probability either by switching sample spaces or by using the formula. cards("7") does it by switching sample spaces. The formula becomes
P(3 or more cards drawn | first card is a "7") = P(3 or more cards drawn first card is a "7")/P(first card is a "7").
P(first card is a "7") = 1/13, obviously. The rest is simulated in cards1.

It is always a good ide to "test" your computer program. For example, if the first card drawn is a "5", we will always need at least two more cards to get to 17, so we know P(3 or more cards drawn | first card is a "5") = 1. Do our programs give this answer?

Multiplication Rule

A simple manipulation of the equation above yields
:

Example : You draw two cards from a standard 52-card deck. What is the probability to draw 2 Aces?
Solution:
Let A = "First card drawn is an ace"
Let B = "Second card drawn is an ace"
Then

It's easy to extend this to more than two events: What is the probability of drawing 4 aces when drawing 4 cards?
Let Ai = "ith card drawn is an ace"
Then

even a little more complicated: In most Poker games you get in the first round 5 cards (Later you can exchange some you don't like but we leave that out). What is the probability that you get 4 aces?
Again let Ai = "ith card drawn is an ace"
Then
prob2fig9.png - 6410 Bytes

Law of Total Probability and Bayes Rule

A set of events {Ai} is called a partition of the sample space if

Example : a student is selected at random from all the undergraduate students at the Colegio
A1 = "Student is female", A2 = "Student is male"
or maybe
A1 = "Student is freshman", .., A4 = "Student is senior"
Let B be any event, then the law of total probability says

Example : A company has 452 employees, 210 men and 242 women. 15% of the men and 10% of the women have a managerial position. What is the probability that a randomly selected person in this company does not have a managerial position?
Hint: for problems such as this which are more complicated it is very important that you go slow and write everything out in detail!
Let A1 = "person is female", A2 = "person is male"
Let B = "person has a managerial position"
Then

This is also part of Bayes' Rule:

Notice that the denominator is just the law of total probability, so we could have written the formula also in this way

only usually the first form is the one that is need because of the available information.

Example : In the company above a person is randomly selected, and that person is in a managerial position. What is the probability the person is female?

Example : As part of the attempt to avoid further terrorist attacks on the US some people have proposed face-recognition technics for airports. Basically each person entering the security checkpoint of the airport is photographed and the digital picture is then compared to a list of pictures of known terrorist suspects. Such systems are never 100% correct, they do make an occasional mistake. Say that the system classifies an actual terrorist as ok 50% of the time (many terrorists won't be in the database because they have never been investigated). This is called a false-negative. Also say that the system wrongly classifies an ok person as a terrorist 0.1% of the time (false-positive). Say at some large airport there are 10 million passengers per year, 20 of whom are actually terrorists. What is the probability that a person classified as a terrorist by the face-recognition system actually is not a terrorist?
Let's use the following notation:
Let A1 = "person is not a terrorist", A2 = "person is a terrorist"
B = "person is classified as a terrorist"
Now

So only 1 in 1000 people "accused" by the system actually is a terrorist!
Note: in this calculation you need to carry along a lot of digits until the final answer.

Example : A company has received three shipments, one each from three different suppliers. The shipment from company 1 contained 37 parts, the one from company 2 had 25 parts and the one from company 3 had 20 parts. An employee randomly selected one part from each shipment and tested it. It turned out one of them was bad. Unfortunately he did not pay attention which part came from which company. From previous experience we know that a part made by company 1 is faulty with probability 0.043. For company 2 the probability is 0.033 and for company 3 it is 0.027. What is the probability that the bad part came from company 2?
Let Ai = "part was made by company i"
B = "part is bad"
then

Bayes' Rule plays a very important role in Statistics and in Science in general. It provides a natural method for updating you knowledge based on data.

Independence

Sometimes knowing that one event occured does not effect the probability of another event. For example if you through a red and a blue die, knowing that the red die shows a "6" will not change the probability that the blue die shows a "2".
Formally we have

or using the multiplication rule we get the better formula for two independent events

Example : Say you flip a fair coin 5 times. What is the probability of 5 "heads"?
Let Ai = "ith flip is heads"
Now it is reasonable to assume that the Ai's are independent and so