How to use the Bayes Theorem Calculator
- 1. Enter the priorType how common A is before any evidence, as a percentage.
- 2. Enter the test ratesAdd the true positive rate and the false positive rate.
- 3. Read P(A | B)See the updated probability and the natural-frequency table.
The formula
P(A | B) = P(B | A) × P(A) ÷ P(B), where P(B) = P(B | A) × P(A) + P(B | not A) × (1 − P(A)). The prior P(A) is what you believe before seeing B. The result is the posterior: what you should believe after seeing B.
Worked example: a disease affects 1% of people. A test catches 95% of cases but also flags 5% of healthy people. P(B) = 0.95 × 0.01 + 0.05 × 0.99 = 0.059, so P(disease | positive) = 0.0095 ÷ 0.059 = 16.1%. Most positives are false alarms, because healthy people vastly outnumber sick ones.
Why the answer surprises people
Think in counts instead of percentages. Out of 10,000 people, 100 have the disease and 95 of them test positive. Of the 9,900 healthy people, 495 also test positive. So only 95 of the 590 positives are real. This mistake, ignoring how rare A is, is called base-rate neglect, and it shows up in spam filters, fraud alerts and machine-learning classifiers too.
- Spam filtering: A = message is spam, B = it contains a certain word.
- Fraud models: even a 99% accurate model raises many false alerts when fraud is rare.
- Naive Bayes classifiers chain this rule across many features at once.
The likelihood ratio, P(B | A) ÷ P(B | not A), tells you how strongly the evidence points to A. Above 10 is strong evidence. Explore classifier trade-offs with the confusion matrix calculator.
Frequently asked questions
What is P(A | not B)?
It is the chance A is still true when the test is negative, such as a missed case. It uses the same inputs.
Can I use decimals instead of percentages?
Enter percentages: 0.5 means 0.5%, not 50%. Type 50 for one half.
Is the Bayes Theorem Calculator free?
Yes, the Bayes Theorem Calculator is free. The first time you see your first result, you are asked for your name and WhatsApp number once. After that, this and every other Uncodemy tool opens straight away without the form.