How to better visualize Bayes’ Theorem

by Shawn Berry

I often see Bayes’ Theorem presented in a satisfactory yet less-than-helpful manner.  Even Wikipedia has an inelegant solution.

First, Bayes’ Theorem simply says that the probability of A intersect B, written P(AB), equals the probability of A given B times the probability of B, written P(A|B) * P(B), and equals the probability of B given A times the probability of A, written P(B|A) *P(A).

Thus, P(AB) = P(A|B) * P(B) = P(B|A) * P(A).

Solving for P(A|B) yields P(B|A) * P(A) / P(B) as Wikipedia boxes in green.

Even more useful is P(A|B) = P(AB) / P(B), which we’ll use with the 2 x 2 chart below.  First notice that the Wikipedia solution uses 6 (typically inexact) floats in its next to last line.



In contrast, I always visualize Bayes’ Theorem with a simple 2 x 2 chart (see below).  For clarity, I continue with the same example.  First capture the stated Totals: 0.5% User and 99.5% Non-User.  Then multiply 0.005 by 0.99 (=.00495) to show that the test is 99% accurate in identifying a User with a Positive test result.  Similarly, multiply 0.995 by 0.99 (=.98505) to show that the test is 99% accurate in identifying a Non-User with a Negative test result:


Remember that P(A|B) = P(AB) / P(B) so P(User|+) = P(User+) / P(+).

Thus, P(User|+) = 0.00495 / 0.01490 = 0.33221.  In English, the probability that someone is a User given they had a Positive test result is only 1/3 (because False Positives are twice as likely as True Positives).

Although the weighted-average Accuracy is a stout 99%, Positive results are only 33% likely to be accurate — which most people would not expect from a test that is 99% likely to identify Users and 99% likely to identify Non-Users.  Remember this 33% Accuracy Rate for Positive results the next time you pee in a cup, have your blood taken, sit on a jury, or get medical results on any infrequent condition.  Be an informed consumer of statistics.  Start with a 2×2 chart to better visualize the data and, if possible, get a 2nd opinion or a 2nd test.  Cheers!