Skip to content
MasterMath

Bayes Theorem Calculator

With a condition 1 % of people have and a test that is right 99 % of the time, testing positive leaves the real probability at 17 %, not 99 %. Bayes' theorem explains why.

If you test positive, the real probability is

—

If you test positive, the real probability is—
Chance of testing positive—
Specificity of the test—
Of every thousand people—
A positive multiplies your probability by—
Before the test—

How this was worked out

    The formula

    P(A|B) = P(B|A) · P(A) ÷ P(B)

    What it means

    The answer depends on how many people have the condition before taking the test at all. If few do, the healthy are so many that even a small rate of false positives produces more false positives than true ones. That is why an excellent test on a rare condition returns, for most of its positives, healthy people.

    How to work it out by hand

    1. Count how many of every thousand have the condition: that is the prevalence
    2. Of those, how many test positive: that is the sensitivity
    3. Of the healthy ones, how many also test positive: those are the false positives
    4. Divide the true positives by all the positives

    What is worth knowing

    The way to grasp it without formulas is to count people rather than juggle percentages. Of a thousand people at 1 % prevalence, ten have it. The test catches nearly all of them, say nine or ten. But of the nine hundred and ninety healthy ones, 5 % of false positives is nearly fifty more people. Total: about sixty positives, of whom only ten really have it. One in six. That is why rare conditions are not screened for en masse, and why a positive is almost always confirmed with a second, different test.

    Frequently asked questions

    What is Bayes' theorem?

    The way to update a probability when new information arrives. It combines what you knew before with how reliable the evidence is.

    Why does a 99 % test not give 99 % certainty?

    Because it depends on how many people have the condition. If few do, the false positives among the many healthy people outnumber the true positives.

    What is specificity?

    The share of healthy people the test correctly returns negative. It is a hundred minus the false positives.

    Why is a positive test repeated?

    Because the second test starts from a far higher prior: no longer the general prevalence but that of someone who has already tested positive once.