Bayes rule exercises: part 4

1. Aircraft emergency locator transmitter

An aircraft emergency locator transmitter (ELT) is a device designed to transmit a signal in the case of a crash. The Altigauge Manufacturing Company makes 80% of the ELTs, the Bryant Company makes 15% of them, and the Chartair Company makes the other 5%. The ELTs made by Altigauge have a 4% rate of defects, the Bryant ELTs have a 6% rate of defects, and the Chartair ELTs have a 9% rate of defects (which helps to explain why Chartair has the lowest market share).

  1. If an ELT is randomly selected from the general population of all ELTs, find the probability that it was made by the Altigauge Manufacturing Company.
  2. If a randomly selected ELT is then tested and is found to be defective, find the probability that it was made by the Altigauge Manufacturing Company.

We use the following notation:

  • A = ELT manufactured by Altigauge
  • B = ELT manufactured by Bryant
  • C = ELT manufactured by Chartair
  • D = ELT is defective
  • D = ELT is not defective (or it is good)
  1. If an ELT is randomly selected from the general population of all ELTs, the probability that it was made by Altigauge is 0.8 (because Altigauge manufactures 80% of them).
  2. If we now have the additional information that the ELT was tested and was found to be defective, we want to revise the probability from part (a) so that the new information can be used. We want to find the value of P(A|D), which is the probability that the ELT was made by the Altigauge company given that it is defective. Based on the given information, we know these probabilities:

    P(A) = 0.80 because Altigauge makes 80% of the ELTs
    P(B) = 0.15 because Bryant makes 15% of the ELTs
    P(C) = 0.05 because Chartair makes 5% of the ELTs
    P(D|A) = 0.04 because 4% of the Altigauge ELTs are defective
    P(D|B) = 0.06 because 6% of the Bryant ELTs are defective
    P(D|C) = 0.09 because 9% of the Chartair ELTs are defective

    Here is Bayes' theorem extended to include three events corresponding to the selection of ELTs from the three manufacturers (A, B, C):

    P(A|D) = (P(A)*P(D|A)) / ([P(A)*P(D|A)]+[P(B)*P(D|B)]+[P(C)*P(D|C)]) = (0.80*0.04) / ([0.80*0.04]+[0.15*0.06]+[0.05*0.09]) = 0.703 (rounded)


2. Ingrowing toenail

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 friend’s 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 / (1*0.0001+0.01*0.9999) ≈ 0.01

That is, even though the test was positive your chance of having swine flu is only 1%. (This is essentially the “defense attorney’s” argument we discussed in the lectures, though in this case it’s 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 / (1*0.005+0.01*0.995) ≈ 0.33

and you should be a lot more worried.


3. Trip to Las Vegas

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 can’t 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 he’s 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 doesn’t pay out. How should you update your estimate of the probability that this is the machine you’re 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(R|NJ) = (P(NJ|R)P(R)) / (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.8*0.5 + 0.9*0.5) ≈ 0.47

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...

P(R|J) = 0.2*0.5 / (0.2*0.5 + 0.1*0.5) ≈ 0.66

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 you’d have to fail to get a payout from the red machine before being say 90% confident it’s not that machine.


4. Genetic defects

1% of people have a certain genetic defect.

90% of tests for the gene detect the defect (true positives).

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?

We can use this formula to find the answer:

P(A|X) = (Pr(X|A)Pr(A)) / (Pr(X|A)Pr(A)+Pr(X|~A)Pr(~A))

The first step into solving Bayes theorem problems is to assign letters to events:

  • A = chance of having the faulty gene. That was given in the question as 1%. That also means the probability of not having the gene (~A) is 99%.
  • X = A positive test result.


  1. P(A|X) = Probability of having the gene given a positive test result.
  2. P(X|A) = Chance of a positive test result given that the person actually has the gene. That was given in the question as 90%.
  3. p(X|~A) = Chance of a positive test if the person doesn’t have the gene. That was given in the question as 9.6%

Now we have all of the information we need to put into the equation:

P(A|X) = (.9 * .01) / (.9 * .01 + .096 * .99) = 0.0865 (8.65%).

The probability of having the faulty gene on the test is 8.65%.


5. A test for cancer

Given the following statistics, what is the probability that a woman has cancer if she has a positive mammogram result?

  • One percent of women over 50 have breast cancer.
  • Ninety percent of women who have breast cancer test positive on mammograms.
  • Eight percent of women will have false positives.

Step 1: Assign events to A or X. You want to know what a woman’s probability of having cancer is, given a positive mammogram. For this problem, actually having cancer is A and a positive test result is X.

Step 2: List out the parts of the equation (this makes it easier to work the actual equation):





Step 3: Insert the parts into the equation and solve:

(0.9 * 0.01) / ((0.9 * 0.01) + (0.08 * 0.99) = 0.10.

The probability of a woman having cancer, given a positive test result, is .010.


If you like my articles,