Bayes' Theorem Calculator
Update prior beliefs with new evidence using Bayes' rule — posterior probability with tree diagram.
All probabilities as decimals between 0 and 1 (e.g. 0.99 for 99%).
Per 10,000 people
Likelihood ratio LR+ = 19.8
Bayes' theorem updates a prior belief in the light of new evidence. Plug in the base rate of a condition, the test sensitivity (true-positive rate), and the false-positive rate; this calculator returns the posterior probability that the condition is actually present given a positive test.
The formula
P(H | E) = P(E | H) · P(H) / P(E), where P(E) = P(E | H) · P(H) + P(E | ¬H) · P(¬H).
P(H) — prior, your belief before seeing the evidence (the base rate).
P(E | H) — likelihood, how often the evidence appears when the hypothesis is true (sensitivity for a medical test).
P(E | ¬H) — false-positive rate, how often the evidence appears when the hypothesis is false.
P(H | E) — posterior, the updated probability after the evidence.
Worked example — the rare-disease puzzle
A disease has a 1% prevalence (P(H) = 0.01). A test has 99% sensitivity (P(+ | H) = 0.99) and 5% false-positive rate (P(+ | ¬H) = 0.05).
A random patient tests positive. What's the chance they actually have the disease?
P(+) = 0.99·0.01 + 0.05·0.99 = 0.0099 + 0.0495 = 0.0594.
P(H | +) = (0.99·0.01) / 0.0594 ≈ 0.1667 — only 17%. Even with a 99% accurate test, a positive on a rare condition is more likely a false alarm than the disease.
This is why population screening is hard: when base rates are low, false positives dominate the positives.
How to think about updates
Bayes is a multiplier on the prior odds. Prior odds = P(H) / P(¬H); posterior odds = prior odds × likelihood ratio (LR+ = sensitivity / FPR).
If LR+ = 20, a positive multiplies your prior odds by 20. A 1% prior (odds 1:99) becomes posterior odds 20:99 → P ≈ 0.168.
This explains why repeating an independent positive test helps: each positive multiplies the odds again. Two independent positives at LR+ = 20 give posterior odds 1:99 · 20² = 400:99 → P ≈ 0.80.
Beyond medical tests
Spam filters — P(spam | features). Prior = base rate of spam in your inbox; likelihood = how often those words appear in spam vs ham.
A/B significance — P(real lift | observed difference). Frequentist p-values implicitly assume a 50/50 prior, which is rarely reasonable for already-shipped features.
Forensics, fault detection, search-and-rescue — anywhere prior knowledge plus an imperfect signal needs to combine into a posterior probability.
Common pitfalls
Base-rate neglect — focusing on the test's accuracy and ignoring the prevalence. The example above is the classic example.
Inverting conditionals — P(E | H) is not P(H | E). A symptom may be 95% likely given the disease, but the disease may still be rare given the symptom.
Assuming independence of tests when they share systematic errors. Two correlated tests don't multiply odds as cleanly as the formula suggests.
Frequently asked questions
What's a 'good' likelihood ratio?
LR+ > 10 is considered strong evidence; 5–10 is moderate; below 2 barely moves the needle. LR− works analogously for negative tests.
Can the prior be 0 or 1?
No — Bayesian updating multiplies the prior, so a prior of exactly 0 or 1 can never change. Use a small ε if you mean 'almost impossible'.
Does this work for continuous evidence?
Same idea, with densities instead of probabilities. P(H | E) ∝ f(E | H) · P(H), normalised by integrating over all hypotheses.
Frequentist vs Bayesian — which is right?
Both are useful. Bayesian explicitly models prior beliefs and updates them; frequentist tools give error-rate guarantees over repeated experiments. They answer different questions about the same data.
More in Statistics & Probability
From z-scores and confidence intervals to t-tests, chi-square, correlation, regression, and the binomial/Poisson distributions — textbook-grade tools with worked examples.
- Z-Score Calculator
Convert a value to a z-score, percentile, and tail probabilities using the standard normal distribution.
- Normal Distribution Calculator
Find P(X<x), P(X>x), and between-range probabilities for any normal distribution with mean μ and SD σ.
- Binomial Distribution Calculator
Compute P(X=k), cumulative probabilities, mean, and variance for n trials with success probability p.
- Poisson Distribution Calculator
Model rare events with rate λ — get P(X=k), cumulative probability, mean, and variance.
- Permutations & Combinations Calculator
Compute nPr (order matters) and nCr (order doesn't) with full counting-principle explanation.
- Confidence Interval Calculator
Compute z or t confidence intervals for a mean, with margin of error breakdown.
Related calculators
Browse all Education →Z-Score Calculator
Convert a value to a z-score, percentile, and tail probabilities using the standard normal distribution.
Normal Distribution Calculator
Find P(X<x), P(X>x), and between-range probabilities for any normal distribution with mean μ and SD σ.
Binomial Distribution Calculator
Compute P(X=k), cumulative probabilities, mean, and variance for n trials with success probability p.
T-Test Calculator
One-sample and two-sample t-tests with t-statistic, p-value, and rejection regions.
Chi-Square Calculator
Goodness-of-fit and independence tests with expected counts, chi-square statistic, and p-value.
Fraction Calculator
Add, subtract, multiply, and divide fractions and mixed numbers — results returned simplified, as a mixed number, and as a decimal.
Standard Deviation Calculator
Mean, median, mode, range, sample/population standard deviation, variance, quartiles, IQR, and SEM for any list of numbers.
Course Grade Calculator
Weighted course grade from assignments, quizzes, and exams. Shows current grade plus the score needed on remaining work.