TTKTheTextKit

Bayes' Theorem Calculator

Enter how common something is, how often a test catches it and how often the test raises a false alarm, and the calculator gives the chance that a positive result is real. It shows the answer as percentages and as counts out of a population, the likelihood ratio, the chance after a negative result, and how the answer climbs when several independent tests all come back positive. A second tab handles the plain form with P(A), P(B given A) and P(B). Everything runs in your browser.

How common A is before the evidence

Chance of a positive when A is true

Chance of a positive when A is false

P(A given positive)
7.764%
Up from 1% before the result
Chance it is a false alarm
92.24%
P(positive)
10.3%
P(A given negative)
0.223%
Likelihood ratio
8.3333
Sensitivity over false positive rate
Specificity
90.4%
Natural frequencies, out of people
Have A100
Have A and test positive80
Have A and test negative20
Do not have A and test positive950.4
Do not have A and test negative8,949.6

Of every 1,030.4 people who test positive, about 80 really have A.

After several positive results in a row (independent tests)
Before any test1%
1 positive result7.764%
2 positive results41.23%
3 positive results85.39%
4 positive results97.99%
5 positive results99.75%

Bayes' theorem says P(A given B) equals P(B given A) times P(A), divided by P(B). In a test, P(B) adds the true positives and the false positives, which is why a rare condition can produce mostly false alarms even with an accurate test. The prior is how common the condition is before the result. The classic example is a screening test with 1% prevalence, 80% sensitivity and a 9.6% false positive rate: a positive result means about a 7.8% chance of having the condition. Several positives in a row assume the tests are independent, which real tests often are not. Everything is worked out in your browser.

Related Tools

[5 suggestions]

About the Bayes' Theorem Calculator

Bayes' theorem says that P(A given B) equals P(B given A) times P(A), divided by P(B). In a test, A is the condition you care about and B is a positive result, so the numbers you need are the prior P(A), the sensitivity P(B given A) and the false positive rate P(B given not A). The denominator P(B) adds up the true positives and the false positives, P(A) times the sensitivity plus P(not A) times the false positive rate. That is why a rare condition can produce mostly false alarms even when the test is accurate. The classic example is a screening test for a condition with 1% prevalence, 80% sensitivity and a 9.6% false positive rate. A positive result means only a 7.8% chance of having the condition, because P(B) is 10.304% and most of it comes from the 99% of people who do not have the condition. The odds form says posterior odds equal prior odds times the likelihood ratio, the sensitivity divided by the false positive rate, which is also how a second positive result is handled when tests are independent. Thinking in natural frequencies, such as 80 true positives against 950 false positives out of 10,000 people, makes the logic easy to see. Real tests are often not independent, and the prior must be the right one for the person being tested.

What is Bayes' theorem in simple terms?▾

It tells you how to update a probability when you get new evidence. You start with how likely something was beforehand, weigh how well the evidence fits when it is true against when it is false, and end with a new probability.

Why is a positive test often a false alarm?▾

When the condition is rare, most people tested do not have it, so even a small false positive rate produces many false alarms compared with the few true cases. With 1% prevalence, 80% sensitivity and a 9.6% false positive rate, only 7.8% of positive results are real.

What is the prior probability?▾

It is the chance of the condition before you see the evidence, usually the base rate in the group you belong to. Choosing the right prior matters a lot, and it is the most common source of mistakes.

Can I use it with more than one test?▾

Yes, if the tests are independent given the condition. Each positive result multiplies the odds by the likelihood ratio, and the calculator shows the chance after up to five positives in a row. If the tests share a cause of error, repeating them helps less than shown.

Is my data uploaded?▾

No. The calculation runs in your browser and nothing you enter is sent anywhere.