Skip to main content

Example

1.1. We have two boxes.
     ~~~~~a) The first contains two green balls and seven red balls
     ~~~~~b) The second contains four green balls and three red balls.
2.2. Bob selects a ball by first choosing one of the two boxes at random.
3.3. He then selects one of the balls in this box at random.
4.4. If Bob has selected a red ball, what is the probability that he selected a ball from the first box?

Solution:1.1. Let
     ~~~~~a) EE be the event that Bob has chosen a red ball
     ~~~~~b) E\overline{E} be the event that Bob has chosen a green ball
     ~~~~~c) FF be the event that Bob has chosen a ball from the first box
     ~~~~~d) F\overline{F} be the event that Bob has chosen a ball from the second box.
2.2. We want to find p(FE)p(F|E), the probability that the ball Bob selected came from the first box, given it is red     p(FE)=p(FE)p(E)~~~~~ p(F|E) = \dfrac{p(F \cap E)}{p(E)}
gambar1 gambar1

Bayes’ Theorem

Suppose that EE and FF are events from a sample space SS such that p(E)0p(E) \neq 0 and p(F)0p(F) \neq 0. Then      p(FE)=p(EF)p(F)p(EF)p(F)+p(EF)p(F)~~~~~ p(F|E) = \dfrac{p(E|F) \cdot p(F)}{p(E|F) \cdot p(F) + p(E|\overline{F}) \cdot p(\overline{F})}

Example

Suppose that one person in 100,000 has a particular rare disease for which there is a fairly accurate diagnostic test. This test is correct 99.0% of the time when given to a person selected at random who has the disease; it is correct 99.5% of the time when given to a person selected at random who does not have the disease. Given this information can we find     ~~~~~a) the probability that a person who tests positive for the disease has the disease?     ~~~~~b) the probability that a person who tests negative for the disease does not have the disease?Should a person who tests positive be very concerned that he or she has the disease?
Solution:Let     ~~~~~a) FF be the event that a person selected at random has the disease     ~~~~~b) EE be the event that a person selected at random tests positive for the disease.We want to compute p(FE)p(F|E). To use Bayes’ theorem to compute p(FE)p(F|E), we need to find p(EF)p(E|F), p(EF)p(E|\overline{F}), p(F)p(F), and p(F)p(\overline{F}).

We know that one person in 100,000 has this disease, so p(F)=1100000=0.00001p(F) = \dfrac{1}{100000} = 0.00001 and p(F)=1p(F)=0.99999p(\overline{F}) = 1 - p(F) = 0.99999.
Because a person who has the disease tests positive 99% of the time, we know that p(EF)=0.99p(E|F) = 0.99.
This is the probability of a true positive, that a person with the disease tests positive. It follows that p(EF)=1p(EF)=10.99=0.01p(\overline{E}|F) = 1 - p(E|F) = 1 - 0.99 = 0.01; this is the probability of a false negative, that a person with the disease tests negative.
Furthermore, because a person who does not have the disease tests negative 99.5% of the time, we know that p(EF)=0.995p(\overline{E}|\overline{F}) = 0.995. This is the probability of a true negative, that a person without the disease tests negative.
Finally, we see that p(EF)=1p(EF)=10.995=0.005p(E|\overline{F}) = 1 - p(\overline{E}|\overline{F}) = 1 - 0.995 = 0.005. This is the probability of a false positive, that a person without the disease tests positive.
The probability that a person who tests positive for the disease actually has the disease is p(FE)p(F|E). By Bayes’ theorem, we have
     p(FE)=p(EF)p(F)p(EF)p(F)+p(EF)p(F)~~~~~ p(F|E) = \dfrac{p(E|F) \cdot p(F)}{p(E|F) \cdot p(F) + p(E|\overline{F}) \cdot p(\overline{F})}
     p(FE)=0.990.000010.990.00001+0.0050.999990.002~~~~~ p(F|E) = \dfrac{0.99 \cdot 0.00001}{0.99 \cdot 0.00001 + 0.005 \cdot 0.99999} \approx 0.002

The probability that someone who tests negative for the disease does not have the disease is p(FE)p(F|E). By Bayes’ theorem, we know that
     p(FE)=p(EF)p(F)p(EF)p(F)+p(EF)p(F)~~~~~ p(\overline{F}|\overline{E}) = \dfrac{p(\overline{E}|\overline{F}) \cdot p(\overline{F})}{p(\overline{E}|\overline{F}) \cdot p(\overline{F}) + p(\overline{E}|F) \cdot p(F)}
     p(FE)=0.9950.999990.9950.99999+0.010.000010.99998~~~~~ p(\overline{F}|\overline{E}) = \dfrac{0.995 \cdot 0.99999}{0.995 \cdot 0.99999 + 0.01 \cdot 0.00001} \approx 0.99998
Consequently, 99.99999% of the people who test negative really do not have the disease.
In part (a) we showed that only 0.2% of people who test positive for the disease actually have the disease. People who test positive for the diseases should not be overly concerned that they actually have the disease