Epidemiology & evidence · Bayesian reasoning
Bayes' Theorem Calculator
Update a belief with evidence — correctly. Give the prior probability of a hypothesis and how likely the evidence is whether or not it's true, and get the posterior P(A | B). The natural-frequency tree below turns the algebra into people, which is the quickest cure for the base-rate fallacy: a strong test for a rare thing still produces mostly false alarms.
Enter probabilities between 0 and 1 (0.9 = 90%). A is the hypothesis (disease, fraud, guilt); B is the evidence you observed (a positive test, a match, a clue).
Result
In plain English
Bayes' theorem is the rule for changing your mind by exactly the right amount. It blends what you believed before (the prior) with how diagnostic the new evidence is (the likelihood ratio) to give what you should believe now (the posterior). Its most famous lesson is that evidence cannot be read on its own: the same positive result means very different things depending on how rare the thing you are testing for is.
- prior P(A)
- How probable the hypothesis was before this evidence — the base rate. Ignore it and you commit the base-rate fallacy.
- likelihood
- How expected the evidence is under each hypothesis: P(B|A) if true, P(B|not A) if false. Their ratio is how much the evidence shifts the odds.
- posterior P(A|B)
- The updated probability of A now that B has been seen. This is the answer Bayes' theorem gives.
- P(A|B) ≠ P(B|A)
- The chance of the disease given a positive test is not the chance of a positive test given the disease. Swapping them is the “prosecutor's fallacy”.
- natural frequencies
- Re-casting the same numbers as counts out of (say) 10,000 people makes the answer obvious where percentages mislead — the trick the tree below uses.
Frequently asked
What is Bayes' theorem?
It is the formula for the probability of a hypothesis A after seeing evidence B: P(A|B) = P(B|A)·P(A) ∕ P(B), where P(B) = P(B|A)·P(A) + P(B|not A)·P(not A). In words: combine how likely the evidence is if A is true with how common A was to begin with, and normalise. It is the mathematically correct way to update beliefs as evidence arrives.
Why can a positive test still mean you probably don't have the disease?
Because of the base rate. If a disease affects 1 in 100 and a test is 90% accurate with a 9% false-positive rate, then out of 10,000 people the 100 who are ill produce about 90 true positives, while the 9,900 who are healthy produce about 891 false positives. A positive result is one of 981, only 90 of which are real — about 9%. The test is good; the disease is just rare, so false alarms dominate.
What is the difference between the prior and the posterior?
The prior is your probability for the hypothesis before the new evidence; the posterior is your probability after updating on it with Bayes' theorem. The evidence moves you from one to the other in proportion to its likelihood ratio — strong evidence moves you a lot, weak evidence barely at all. Today's posterior becomes tomorrow's prior when the next piece of evidence arrives.
What if I have more than two hypotheses or several pieces of evidence?
The same rule scales. For several competing hypotheses, compute P(B | each)·P(each) and normalise so they sum to 1. For several pieces of evidence, update one at a time — today’s posterior becomes tomorrow’s prior — provided the pieces are conditionally independent given the hypothesis. When they are not (correlated clues that really say the same thing), treating them as independent double-counts the evidence and overstates your certainty.