Practice With Baye - S Theorem

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

MATH 3104: Practice with Bayes theorem

A/Prof Geoffrey Goodhill

Solutions
1. You go to see the doctor about an ingrowing toenail. The doctor selects you at random to have
a blood test for swine flu, which for the purposes of this exercise we will say is currently suspected
to affect 1 in 10,000 people in Australia. The test is 99% accurate, in the sense that the probability
of a false positive is 1%. The probability of a false negative is zero. You test positive. What is the
new probability that you have swine flu?
Now imagine that you went to a friends wedding in Mexico recently, and (for the purposes of this
exercise) it is know that 1 in 200 people who visited Mexico recently come back with swine flu.
Given the same test result as above, what should your revised estimate be for the probability you
have the disease?
Let P (D) be the probability you have swine flu.
Let P (T ) be the probability of a positive test.
We wish to know P (D|T ).
Bayes theorem says
P (D|T ) =

P (T |D)P (D)
P (T )

which in this case can be rewritten as


P (D|T ) =

P (T |D)P (D)
P (T |D)P (D) + P (T |ND)P (ND)

where P (ND) means the probability of not having swine flu.


We have
P (D) = 0.0001 (the a priori probability you have swine flu).
P (ND) = 0.9999
P (T |D) = 1 (if you have swine flu the test is always positive).
P (T |ND) = 0.01 (1% chance of a false positive).
Plugging these numbers in we get
P (D|T ) =

1 0.0001
0.01
1 0.0001 + 0.01 0.9999

That is, even though the test was positive your chance of having swine flu is only 1%. (This is
essentially the defense attorneys argument we discussed in the lectures, though in this case its
not a fallacy because your P (D) is indeed very low.)
However, if you went to Mexico recently then your starting P (D) is 0.005. In this case
P (D|T ) =

1 0.005
0.33
1 0.005 + 0.01 0.995

and you should be a lot more worried.

2. Imagine that, while in Mexico, you also took a side trip to Las Vegas, to pay homage to the
TV show CSI. Late one night in a bar you meet a guy who claims to know that in the casino at
the Tropicana there are two sorts of slot machines: one that pays out 10% of the time, and one
that pays out 20% of the time [note these numbers may not be very realistic]. The two types
of machines are coloured red and blue. The only problem is, the guy is so drunk he cant quite
remember which colour corresponds to which kind of machine. Unfortunately, that night the guy
becomes the vic in the next CSI episode, so you are unable to ask him again when hes sober.
Next day you go to the Tropicana to find out more. You find a red and a blue machine side by side.
You toss a coin to decide which machine to try first; based on this you then put the coin into the
red machine. It doesnt pay out. How should you update your estimate of the probability that this
is the machine youre interested in? What if it had paid out - what would be your new estimate
then?
Let P (R) be the probability that the red machine is the one that pays out more often; similarly
P (B) = 1 P (R).
Let P (J) be the probability of payout (jackpot).
We are interested in P (R|NJ).
Bayes theorem says
P (NJ|R)P (R)
P (R|NJ) =
P (NJ|R)P (R) + P (NJ|B)P (B)
We start with P (R) = P (B) = 0.5. This gives us
P (R|NJ) =

0.8 0.5
0.47
0.8 0.5 + 0.9 0.5

If the red machine did pay out then we have


P (R|J) =

P (J|R)P (R)
P (J|R)P (R) + P (J|B)P (B)

Substituting in....

0.2 0.5
0.66
0.2 0.5 + 0.1 0.5
That is, a pay-out makes you a lot more confident about which is the good machine than no payout. This makes sense since paying out is a rare event, so you would expect it to give you a lot of
information.
You may like to take this further by considering how many times youd have to fail to get a payout
from the red machine before being say 90% confident its not that machine.
P (R|J) =

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy