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:
prob2fig1.png - 5489 Bytes
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"
prob2fig2.png - 951 Bytes
What is the probability that a randomly selected volunteer in this study is a former smoker ?
prob2fig3.png - 816 Bytes
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:
prob2fig4.png - 1619 Bytes
In general we can find conditional probabilities using the formula
prob2fig5.png - 866 Bytes
Note: this only works if P(B)>0

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 mean number of cards drawn.
use f <- edit() to set up the editor
function(n=10000) {
cards <- c(2:10,10,10,10,11)
z<-rep(0,n)
for(i in 1:n) {
points <- 0
for(j in 1:20) {
points <- points + sample(cards,1)
z[i] <- j
if(points>16) break
}
}
mean(z)
}

Say your first card is a 7. How many more cards will you draw?

Multiplication Rule

A simple manipulation of the equation above yields
prob2fig6.png - 719 Bytes:
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
prob2fig7.png - 3401 Bytes
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
prob2fig8.png - 5840 Bytes
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
prob2fig10.png - 1323 Bytes
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
prob2fig11.png - 996 Bytes
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
prob2fig12.png - 4087 Bytes

This is also part of Bayes' Rule:
prob2fig13.png - 1596 Bytes
Notice that the denominator is just the law of total probability, so we could have written the formula also in this way
prob2fig14.png - 1094 Bytes
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?
prob2fig15.png - 1899 Bytes

Example 1: 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
prob2fig16.png - 5553 Bytes
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 2: 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
prob2fig20.png - 1769 Bytes

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
prob2fig17.png - 549 Bytes
or using the multiplication rule we get the better formula for two independent events
prob2fig18.png - 692 Bytes
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
prob2fig19.png - 2124 Bytes