Bayes Theorem
In many applications, it can be difficult to directly calculate a conditional probability. The problem is that it is not always easy to determine a complete stochastic truth table. For example, suppose that you receive an email with the phrase "free money" in the subject, and you are wondering whether the email is spam. Let mean "the email is spam" and mean "the phrase 'free money' is in the subject of the email". You want to determine whether the evidence evidentially supports the hypothesis . To do this, you need to determine . It is not obvious what probabilities you should assign to each row of a stochastic truth table for the atomic propositions and . There is an indirect way to determine this conditional probability.
Since , we have that
Since , we have that
Now, since and are tautologically equivalent, we have that
Dividing both sides by , we have that:
So, we can determine if we know three other probabilities 1. , 2. and 3. . These are all probabilities that we can estimate with some investigation.
- : This is the probability that the phrase "free money" occurs in the subject line of spam email. That is, is the probability that the subject line contains the phrase "free money" assuming that the email is spam. The phrase "free money" is in the list of spam trigger words. There are other phrases that might occur in spam email. A good estimate for this conditional probability is .
- : This is the prior probability of receiving spam email. Roughly, 55% of email received each day is classified as spam. That is, .
- : This is the prior probability of receiving an email with the phrase "free money" in the subject line. While it is not obvious how to estimate this probability directly, we can use the law of total probability: . We have already determined that and . Thus, using the complement law, we know that . The only thing that remains is to estimate . That is, assuming an email is not spam, what is the probability that phrase "free money" occurs in the subject line. It is very unlikely that I would receive an email with the phrase "free money" in the subject line (your estimate of this conditional probability may be different). My estimate of this conditional probability is . Then, using the law of total probability, we have
Putting everything together, we have that:
The above equation is an instance of Bayes Theorem:
For all formulas and ,
As noted above, we often use the law of total probability when applying Bayes Theorem:
For all formulas and ,
- Lecture
- Slides
Applying Bayes Theorem can be tricky. Use Bayes Theorem to solve the following puzzles:
Three Prisoner's Problem: Three prisoners and have been tried for murder and their verdicts will told to them tomorrow morning. They know only that one of them will be declared guilty and will be executed while the others will be set free. The identity of the condemned prisoner is revealed to the very reliable prison guard, but not to the prisoners themselves.
Prisoner asks the guard ``Please give this letter to one of my friends --- to the one who is to be released. We both know that at least one of them will be released".
An hour later, asks the guard ``Can you tell me which of my friends you gave the letter to? It should give me no clue regarding my own status because, regardless of my fate, each of my friends had an equal chance of receiving my letter."
The guard told him that received his letter.
Prisoner then concluded that the probability that he will be released is 1/2 (since the only ones without a verdict are and ).
But, thinks to himself: "Before I talked to the guard my chance of being executed was 1 in 3. Now that he told me has been released, only and I remain, so my chances of being executed have gone from 33.33% to 50%. What happened? I made certain not to ask for any information relevant to my own fate..." Explain what is wrong with 's reasoning.
Monty Hall Dilemma: Suppose you are on a game show, and you are given the choice of three doors. Behind one door is a car behind the others, goats. You pick a door, say number 1, and the host, who knows what's behind the doors, opens another door, say number 3, which has a goat. He says to you, "Do you want to pick door number 2?" Is it to your advantage to switch your choice of doors?
Trying answering the above questions before watching the following video.
- Lecture
- Slides
Practice Questions
- Suppose that , , , find . Explain how you arrived at your answer.
- Suppose that , , , find . Explain how you arrived at your answer.
- Suppose that , , , find . Explain how you arrived at your answer.
- Suppose that you know that it rains 10% of days, it is cloudy in the morning 20% of the days and when it rains in the afternoon, 50% of the time there were clouds in the morning. Suppose that you see clouds in the morning, what is the probability that it will rain in the afternoon?
- Suppose we have the following information about a gene defect: 1% of people have a certain genetic defect; 90% of tests for the gene detect the defect (true positives); and 9.6% of the tests are false positives.
If a person gets a positive test result, what are the odds they actually have the genetic defect?