Bayes' Theorem for Disease Testing

Not Reviewed
Equation / Last modified by Caroline4 on 2018/08/27 03:47
`P(A|B) = `
Copied from
Caroline4.Bayes' Theorem for Disease Testing

Bayes' Theorem, `P(A|B) = (P(B|A)*P(A))/(P(B))`, computes the probability of event A occurring if event B is true. This can be especially useful in the field of medicine and diagnosis of rare diseases because many people misinterpret disease statistics. In disease diagnosis (A) represents having the disease and (B) represents testing positive for the disease.  Bayes’ Theorem can answer the question “What is the probability that you have a disease given that you have tested positive for it?” P(A∣B)

Interpreting Statistics Online

In diagnosis, a positive test does not necessarily mean that you have the disease. In fact, with mass testing for relatively rare diseases, it may still be more likely that you don’t have the disease even if you have tested positive for it.  The following example illustrates why.

Example: Dinosaur disease

Imagine that 1 out of every 10,000 people has a hypothetical disease that we will call dinosaur disease, and that the diagnostic tests used for dinosaur disease have a 95% accuracy rate. That means that people who have the disease will test positive 95% of the time.  However, 2% of the time, the tests report false positives, meaning that 2% of the people who don’t have the disease will nevertheless test positive for it. It is important to remember the base rate - in this case, 1 in 10,000.

Using Bayes' Theorem to represent the events, P(A) is the simple probability of having dinosaur disease. Based on the base rate we know that P(A) = .0001. P(B|A) is the probability of testing positive given that you have disease P(B|A) = .95. The probability of a false positive can be represented by P(B|not A), because it is the probability of testing positive when dinosaur disease is not present P(B|not A) = .02. P(B) can be found by adding the probability of testing positive and having the disease and the probability of testing positive and not having the disease. P(B) = P(B|A)*P(A) + P(B|not A)*P(not A). So in this case, P(B) = .95*.0001 + .02*.9999 = .02, which means there is a 2% chance of testing positive for dinosaur disease. This makes sense, because its occurrence is rare (1 out of every 10,000). When the formula is completed, P(A|B) represents the probability of having dinosaur disease, given that the test was positive. So `P(A|B) = (P(B|A)*P(A)) /(P(B))` = `(0.95*0.0001) /0.02` = 0.0047, meaning the chance of having dinosaur disease if the test is positive is about half of one percent!

Since dinosaur disease is so rare (1 out of 10,000), the number of false positives is much higher than the number of true positive diagnoses. People often overlook the base rate and just look at how accurate the test is.  Even with a highly accurate test if the base rate is very low, then there are likely to be more false alarms than true positives.


Su, F. (2010). Medical tests and Bayes’ Theorem. Math Fun Facts. Retrieved from

Stone, J. V. (2012). Vision and brain: How we perceive the world. Cambridge, MA: MIT Press Books.

See Also

Supplementary explanation for Bayes' Theorem regarding disease testing


This equation, Bayes' Theorem for Disease Testing, is listed in 2 Collections.