Bayes' Theorem Calculator
Enter a prior probability, true positive rate, and false positive rate to compute the posterior probability using Bayes' theorem. The tree diagram, contingency table, and natural frequency breakdown help you see why a positive test result does not always mean what you think it means.
Probability Tree
Parameters
Posterior Probability
Contingency Table
| Test Positive (B) | Test Negative (not B) | Total | |
|---|---|---|---|
| Has A | 95 | 5 | 100 |
| No A | 495 | 9405 | 9900 |
| Total | 590 | 9410 | 10000 |
Natural Frequency
Out of 10,000 people:
Of those who test positive (590 people):
So only 95 out of 590 positive results are actually correct.
Step-by-Step Calculation
1. Bayes' Theorem
2. Total probability of B
3. Substitute into P(B)
4. Compute posterior
5. As a percentage
Reference Guide
Bayes' Theorem
Bayes' theorem describes how to update a probability estimate when new evidence arrives. It relates the probability of a hypothesis given data to the probability of the data given the hypothesis.
is the prior (your belief before evidence), is the likelihood (how likely the evidence if the hypothesis is true), and is the posterior (your updated belief).
Total Probability
The denominator is the total probability of observing the evidence. It accounts for both true positives and false positives.
When the condition is rare (low prior), false positives can easily outnumber true positives. This is why the probability tree and contingency table are so useful for building intuition.
The Base Rate Fallacy
People often ignore the base rate (prior probability) and focus only on the test accuracy. A 95% accurate test sounds reliable, but when the condition is rare (say 1%), most positive results are actually false positives.
With 1% prevalence, 95% sensitivity, and 5% false positive rate, a positive result only means about a 16% chance of actually having the condition. This is why medical screening for rare diseases produces so many false alarms.
Natural Frequencies
Research shows that people understand Bayes' theorem much better when probabilities are presented as natural frequencies instead of percentages.
Instead of saying "the test has 95% sensitivity and 5% false positive rate," it is clearer to say "out of 10,000 people, 100 have the condition, and of those 100, 95 test positive. Of the 9,900 without the condition, 495 also test positive."
So out of 590 positive tests, only 95 are truly positive. That makes the 16% posterior probability much easier to see.