Published · · Last reviewed · · 6 min read

English · 한국어

What a positive test really means: Bayes' theorem and false positives

Note: every figure on this page is an invented value chosen for teaching. It does not describe the accuracy of any real test or the frequency of any real disease, and it is not medical advice. Decisions about health belong with a medical professional. This page is about the arithmetic of probability, not medicine.

"The test is 90% accurate and mine came back positive. Is there a 90% chance I have the condition?" Many people feel the answer is yes, and it is natural to feel so. It is almost always wrong. In this page's invented example the chance is about 8%. The drop from 90 to 8 is not because the test is inaccurate but because the condition is rare to begin with. We work through the calculation slowly with natural frequencies and provide a calculator for changing the numbers.

The invented setup

Suppose there is an imaginary condition X and a test to detect it.

When someone tests positive, what is the chance they really have X?

Solving with natural frequencies

Instead of probabilities, count people. That this makes the calculation easier is a finding associated with Gerd Gigerenzer and Ulrich Hoffrage (1995); we confirmed only that paper's bibliographic record and an abstract-level claim. Imagine 10,000 people take the test.

10,000 imaginary people tested
GroupPeoplePositiveNegative
Have X (1%)1009010
Do not have X (99%)9,9009908,910
Total10,0001,0808,920

The positives number 90 + 990 = 1,080. Of these, 90 really have X, so the share is 90 ÷ 1,080 = 8.33%. The other 91.7% do not have X and tested positive by mistake. With 9,900 people without X, even 10% of them is 990, which swamps the 90 true positives.

Change the numbers in the calculator

Vary prevalence, sensitivity and specificity to see what happens. (Invented values.)

This tool needs JavaScript.

Bayes' theorem

Written as a formula, the calculation above is Bayes' theorem. The chance of X given a positive result is:

P(X | positive) = P(positive | X) × P(X) ÷ [P(positive | X) × P(X) + P(positive | not X) × P(not X)]

With the numbers: (0.9 × 0.01) ÷ (0.9 × 0.01 + 0.1 × 0.99) = 0.009 ÷ 0.108 = 0.0833. The numerator is the share of true positives and the denominator is all the ways to be positive. If the formula looks hard, think back to the table of people; they are the same calculation.

The key variable: prevalence

With the same test (90% sensitivity, 90% specificity), a different prevalence changes the meaning of a positive result greatly.

Same test: chance of really having X after a positive result, by prevalence (invented)
PrevalenceChance of X given positive
0.1%0.89%
1%8.33%
10%50.00%
50%90.00%

In a group where prevalence is high, as when people already have symptoms before being tested, the same positive weighs far more. Even for the same test, the meaning of the result depends on who it is used on. Conversely, when people with no symptoms or risk factors are tested widely, false positives easily make up a large share of positive results. That is the point of this invented example; for how the figures stand for any real test, consult that test's official information.

Another variable: specificity

False positives are the root of the problem, so raising specificity has a large effect. With prevalence 1% and sensitivity 90%:

Chance of X after a positive result, by specificity (prevalence 1%, sensitivity 90%, invented)
SpecificityChance of X given positive
90%8.33%
99%47.62%
99.9%90.09%

For the false-positive problem, raising specificity does more than raising sensitivity. Even with both at 99%, a prevalence of 1% gives a 50% real chance after a positive. That is why "99% accurate" in a promotion deserves caution: accuracy is often unclear about whether it means sensitivity, specificity or an average of the two.

If a second test is positive again

Suppose someone who tested positive takes the same test again and is positive again. The 8.33% after the first positive now becomes the starting point (the prior). In the same formula: (0.9 × 0.0833) ÷ (0.9 × 0.0833 + 0.1 × 0.9167) = 0.075 ÷ 0.1667 = 45.0%. A second positive lifted it from 8% to 45%. This calculation assumes the two results are independent, though. Testing the same person the same way can repeat a false positive for the same reason, so in reality the assumption often fails, and the real probability may be lower than this.

And a negative result?

In the same invented setup, the chance of not having X after a negative result is 8,910 ÷ 8,920 = 99.89%. When prevalence is low, a negative is very reliable and a positive is not. This asymmetry is what unsettles intuition.

Why intuition goes wrong

Link to lotteries and games

The same structure meets lotteries. "66% of jackpot winners are auto" and "the probability that an auto game wins" differ in the direction of the condition, and the error discussed in the earlier auto versus manual article is a cousin of this one. Before reading the share in one direction as a probability in the other, always check the denominator. The calculation in the Monty Hall problem has the same Bayesian structure.

An example outside medicine: an alarm

The same structure shows up outside medicine. A building entrance has an alarm that detects intruders, and suppose 1 in 1,000 visitors is an intruder (invented). The device detects 99% of intruders (sensitivity) and stays silent for 99% of non-intruders (specificity 99%). When the alarm sounds, the chance that it is a real intruder is (0.001 × 0.99) ÷ (0.001 × 0.99 + 0.999 × 0.01) = 9.0%. Although 99% appears twice, 91% of alarms are false. The reason is the same: intruders are rare.

In such a setting, rather than being startled each time the alarm sounds, ask "what share of these alarms is real?". Knowing that share lets you set a reasonable verification procedure after an alarm. Similar situations arise in spam filters, fraud detection and security scanning tools.

Questions that come up

What does "a test with 90% accuracy" mean? In this invented setup sensitivity and specificity are both 90%. In practice "accuracy" is used in several senses: one of the two, their average, or the overall share correct. Without knowing which, this page's calculation cannot be applied.

Is a test with many false positives a bad test? Not necessarily. A test that screens widely for a rare condition may aim not to miss cases even at the price of many false positives, with a positive result checked by another test. Whether a test is good depends on its purpose. This page does not rate any test.

What should I do after a positive result? This page gives no medical advice. Discuss the meaning of a positive result and the next steps with a medical professional.

Limits

The figures are invented for teaching. This is not medical advice and does not describe any real test.

Sources and verification