About the Bayesian Calculator
What is the Bayesian Calculator?
Bayes' theorem updates a probability when new evidence arrives. Its classic use is interpreting a test: even an accurate test can give more false positives than true positives when the condition being tested for is rare. The starting probability (the base rate or prior) matters as much as the test's accuracy.
Enter how common the condition is, the test's sensitivity (how often it catches a real case) and specificity (how often it correctly clears a non-case). The calculator gives the probability of the condition after a positive result and after a negative one, and a table showing what happens to 10,000 people.
How to use the Bayesian Calculator
- Prior Probability / Base Rate (%) — the base rate before the test — for example, the prevalence of a disease. (sample: 10)
- Sensitivity – true positive rate (%) — the percentage of real cases the test correctly flags as positive. (sample: 92)
- Specificity – true negative rate (%) — the percentage of non-cases the test correctly reports as negative. (sample: 88)
- Press Apply Bayes' Theorem (results also refresh as you type). The result card shows the Probability After a Positive Result, along with P(condition | negative result), Negative predictive value, Chance of a positive result and Positive likelihood ratio.
Formula used
P(C | +) = P(+ | C) × P(C) ÷ P(+)
- P(C) = the prior probability (base rate)
- P(+ | C) = sensitivity, the true positive rate
- P(+) = sensitivity × P(C) + (1 − specificity) × (1 − P(C))
Negative predictive value = specificity × (1 − P(C)) ÷ P(−). The positive likelihood ratio, sensitivity ÷ (1 − specificity), shows how much a positive result raises the odds.
Worked example
These are the sample values already filled in the calculator above, and the result it returns for them:
| Input | Sample value |
|---|---|
| Prior Probability / Base Rate (%) | 10 |
| Sensitivity – true positive rate (%) | 92 |
| Specificity – true negative rate (%) | 88 |
| Result | Value |
|---|---|
| P(condition | positive result) | 46% |
| P(condition | negative result) | 1% |
| Negative predictive value | 99% |
| Chance of a positive result | 20% |
| Positive likelihood ratio | 7.67 |
Tips for using the Bayesian Calculator
- With a 1% base rate and a 95%-accurate test, a positive result means only about a 16% chance of having the condition.
- Repeat testing helps: the posterior after one positive becomes the prior for the next test.
- Beyond medicine, the same logic applies to spam filters, fraud alerts and quality inspection.
