Bayes Theorem Calculator

Bayes theorem: find P(A | B) and P(A | not B) from the prior P(A), sensitivity P(B | A) and false-positive rate P(B | not A), with a table out of 10,000 people.

%
How common A is before seeing the evidence. Example: 1% of people have a condition.
%
Also called sensitivity or true-positive rate.
%
The false-positive rate. It equals 100% minus the specificity.

Results

P(A | B): chance A is true given the evidence B
90.9836 %
P(A | not B): chance A is true given no evidence B
0.001 %
P(B): overall chance of the evidence
1.098 %
Likelihood ratio, P(B | A) ÷ P(B | not A)
999
Out of 10,000: A true and B seen
99.90
Out of 10,000: A true and B not seen
0.10
Out of 10,000: A false and B seen
9.90
Out of 10,000: A false and B not seen
9,890.10
In words
Of every 10,000 cases, 109.8 show the evidence B. Of those, 99.9 really have A, which is 90.9836%.

Estimate only. This tool is for informational and educational purposes. Results depend on your inputs and simplifying assumptions, and are not a substitute for professional engineering, design or financial advice. Always verify with a qualified professional and applicable codes before purchasing, building or making decisions.

How it’s calculated

Bayes theorem updates a probability when you learn new evidence. You start with a prior, P(A), how likely A is before looking. You then see evidence B and want the posterior, P(A | B). The surprise for many people is how much the prior matters: even a very accurate test gives a modest posterior when A is rare.

P(B) = P(B | A)·P(A) + P(B | not A)·P(not A) P(A | B) = P(B | A)·P(A) ÷ P(B) P(A | not B) = (1 − P(B | A))·P(A) ÷ (1 − P(B))

Worked example (Siegrist, Conditional Probability, diagnostic testing): 1% of people have a condition and the test has sensitivity 0.999 and specificity 0.999, so the false-positive rate is 0.001. P(B) = 0.999 × 0.01 + 0.001 × 0.99 = 0.00999 + 0.00099 = 0.01098. Then P(A | B) = 0.00999 ÷ 0.01098 = 0.9098, i.e. 90.98%. In natural frequencies, out of 10,000 people about 99.9 have the condition and test positive, 0.1 have it and test negative, 9.9 do not have it but test positive, and 9,890.1 do not have it and test negative. So among about 109.8 positives, 99.9 are real.

This page is for learning probability. It is not medical advice, and it does not tell you what a real test result means for you; ask a clinician, who knows your actual situation and the test's real performance.

Frequently asked questions

What is the false-positive paradox?

When A is rare, false alarms from the many cases without A can outnumber the true detections, so a positive result may be less convincing than the test accuracy suggests. Try a 0.1% prior with the same test to see it.

What are sensitivity and specificity?

Sensitivity is P(B | A), the chance the evidence appears when A is true. Specificity is P(not B | not A). The false-positive rate used here is 1 minus specificity.

Why does the page show a table out of 10,000?

Counting people instead of juggling decimals is easier to understand. Each box is the number of cases with that combination of A and B. Dividing the A-and-B box by the total of the B column gives P(A | B).

What if I know specificity instead of the false-positive rate?

Subtract it from 100%. A specificity of 99.9% means a false-positive rate of 0.1%.

Embed this calculator

Add this free calculator to your own website. Copy the code below into your page’s HTML:

Need this calculator branded, changed or built around your own prices?See custom business solutions →

Sources

Formulas are taken from the free public references above. Results are provided “as is” for informational and educational purposes only. See our disclaimer.

Added · Last updated · How we check our calculators

Spotted a mistake or missing option? Report a problem· Suggest a calculator