# What am I doing wrong in this Baye's theorem equation

I have to find the probability that that a woman does not have cancer, given that her mammogram came back positive.

Facts needed:

0.1% of all women have breast cancer

probability of a positive test when a tumor is present is 40%

probability of a positive test when no tumor is present is 10%

I used Baye's theorem: T = tumor present, T' = no tumor present, P = positive test

P(T'|P) = (P(P|T')*P(T'))/P(P)
=(P(P|T')*P(T'))/(P(P|T')*P(T') +P(P|T)*P(T))
=((0.1)*(0.999))/((0.1)*(0.999) + (0.4)(0.001))
=((0.1)*(0.999))/(0.1003)


and I get 99.6% which does not make sense.

Please help me understand what I am doing wrong, thanks.

• What about your result doesn't make sense? – Alexander Etz Apr 29 '16 at 4:02
• Because a positive test should indicate that the woman has a tumor. So if the test came back positive, then it shouldn't have such a high probability that there's no tumor present. – Ryan Williams Apr 29 '16 at 4:13
• @RyanWilliams Your math is correct! What's not correct is the intuitive notion that, "if the test came back positive, then it shouldn't have such a high probability that there's no tumor present," at least for the probabilities given in this particular problem. – Matthew Gunn Apr 29 '16 at 6:05
• I also had difficulty with getting Bayes' Theorem intuitive even after learning its maths and applications by core. After watching 10-15 videos about the topic I found THIS PARTICULAR ONE which made it very clear and should back up the awesome answers by @Jamie Hall and @Alexander Etz – Mauricio Ramalho Custodio Apr 29 '16 at 7:04
• The guy's name was Bayes, so Bayes' theorem or possibly Bayes's theorem, but not Baye's. Please fix your title. – Glen_b Apr 29 '16 at 8:20

I think you're confused by the fact that it seems like you're getting back your prior probability unchanged, 99.6% tumor-free, which is virtually the same as what you started with.

The broader answer is that you're on the right track: a sorta-accurate test for a rare disease will always give you this style of result. To try to get the intuition straight, you could try pondering the statement of Bayes' Theorem that people sometimes use: "extraordinary claims require extraordinary evidence". Here, by assumption, it's extraordinary (=rare) to have breast cancer, and the evidence from the test is very weak.

In fact, this is one of a classic set of examples showing that it's hard to think intuitively about conditional probabilities. There's a concise write-up of the 'medical test' example here, and I'd recommend Williams's Weighing the Odds for a longer discussion.

• The initial probability of no tumor was .999, not .996. – Alexander Etz Apr 29 '16 at 4:39

A positive test result is certainly evidence for a tumor, in that it makes the tumor more likely. But it is very unlikely for the woman to have one in the first place, so you need a lot of evidence to make it probable she has one. In other words, you need a lot of evidence to overcome that initial low prior probability. Perhaps it is easier to think about the odds form of Bayes' rule here. Namely,

$$\underbrace{\frac{p(T' \mid \text{data})}{p(T \mid \text{data})}}_{\text{Posterior odds}}=\underbrace{\frac{p(T')}{p(T)}}_{\text{Prior odds}} \times \,\, \underbrace{\frac{p(\text{data} \mid T')}{p(\text{data} \mid T)}}_{\text{Bayes factor BF}}$$

You started with prior odds of .999/.001 in favor of no tumor, T'. The probability of a positive test given a tumor is .4, and the probability of a positive test given no tumor is .1, so you have a Bayes factor against no tumor of .1/.4. Now lets plug this back into the formula above,

$$\underbrace{\frac{p(T' \mid \text{data})}{p(T \mid \text{data})}}_{\text{Posterior odds}}=\underbrace{\frac{.999}{.001}}_{\text{Prior odds}} \times \,\, \underbrace{\frac{.1}{.4}}_{\text{Bayes factor BF}} = \frac{.0999}{.0004}= \frac{249.75}{1}.$$

Your positive test has considerably changed the odds: from 999 to 1 in favor of no tumor, down to ~250 to 1 in favor of no tumor. But that is still overwhelmingly in favor of no tumor. The probability of no tumor is 249.75/250.75 = .996. (Your math was correct)