30% off your first 3 months

Get the deal

Conditional probability with a screening test

by DuckyHelperNov 12, 20264 min read
Math

TL;DR:

  • Conditional probability asks: given that we know this, how likely is that?

  • Counting people (natural frequencies) makes the answer clear. In the example, 18 out of 67 positives are truly sick.

  • The chance of a positive given sick is not the chance of sick given a positive.

A screening test for a condition is accurate. You test positive. How worried should you be? The answer depends on something people often ignore: how common the condition is. The numbers below are invented for teaching and do not describe any real test or illness.

Conditional probability in one sentence

P(A given B) is the probability of A when you already know B happened. It is found by restricting attention to the cases where B is true, and asking what fraction of those also have A.

Worked example: a test on 1,000 people with a rare condition

Imagine a group of 1,000 people. Suppose, hypothetically, that 20 of them have the condition and 980 do not. Suppose the test catches 18 of the 20 who have it, and wrongly flags 49 of the 980 who do not (a false positive rate of 49/980 = 1/20).

  1. People with the condition and a positive test: 18.

  2. People with the condition and a negative test: 20 − 18 = 2.

  3. People without the condition and a positive test: 49.

  4. People without the condition and a negative test: 980 − 49 = 931.

Group

Positive

Negative

Total

Has condition

18

2

20

No condition

49

931

980

Total

67

933

1000

The 1,000 people

Total positives: 18 + 49 = 67. Of those, 18 really have the condition. So P(has condition given positive) = 18/67 ≈ 0.27. A bit over one in four.

Why so low?

Because the condition is rare, healthy people vastly outnumber sick ones. Even a small false positive rate, applied to 980 people, produces 49 false alarms, more than the 18 true detections. The test is good at flagging sick people (18 of 20) but a positive result is still more likely to be a false alarm than a real case.

A tree diagram says the same thing

Split the 1,000 people first by condition: 20 and 980. Then split each branch by test result. The four ends of the tree hold 18, 2, 49 and 931 people. The positive branches are the 18 and the 49. To find the probability of the condition given a positive, divide the 18 by the sum of the two positive branches: 18/(18 + 49) = 18/67.

Two different questions

P(positive given condition) = 18/20 = 0.9 answers: of those who are sick, how many does the test catch? P(condition given positive) = 18/67 ≈ 0.27 answers: of those who test positive, how many are sick? These are not the same, and swapping them is the single most common mistake. The first depends on how good the test is. The second also depends on how common the condition is.

Change the base rate and see

Suppose the same test is used on 1,000 people where 200 have the condition. It catches 90% of them, which is 0.9 × 200 = 180. Of the 800 without it, it wrongly flags 5%, which is 0.05 × 800 = 40. Now the positives are 180 + 40 = 220, and 180 are truly sick, so 180/220 ≈ 0.82. Same test, more common condition, a much more reliable positive. This is why screening is handled differently for groups with different risks.

Note: These numbers are an invented teaching example. For real health questions, talk to a doctor. This article is about reading numbers, not medical advice.

What a second test would do

Suppose the 67 people who tested positive are tested again, and assume (as a simplification) that the test errors are independent each time. Of the 18 truly sick, a test catching 90% finds 0.9 × 18 = 16.2 on average. Of the 49 healthy, a false positive rate of 5% flags 0.05 × 49 = 2.45. Now the positives number 16.2 + 2.45 = 18.65, and 16.2 / 18.65 ≈ 0.87. A second positive is far more convincing than the first, because the false alarms get thinned out much faster than the true cases.

How to check your answer

  • Totals. Rows and columns must add to 1,000.

  • Denominator. For "given positive", the denominator is the positives only: 67.

  • Reverse check. 18/20 and 18/67 should differ. If you get the same number, the question was mixed up.

  • Sanity. The answer must be between 0 and 1.

Common mistakes

  • Dividing by the whole group (1,000) instead of the restricted group.

  • Ignoring the base rate.

  • Using percentages without a population, which hides the sizes of groups.

  • Mixing the two conditional probabilities.

  • Forgetting that false positives come from the large healthy group.

Where you will use it next

Conditional reasoning builds on probability basics with dice, and shows up whenever you read a result in context. For a related skill, summarising a group honestly, see mean, median and mode.

Frequently asked questions

Is this Bayes' theorem?

Yes. Counting people is Bayes' theorem in disguise: P(A given B) = P(B given A) × P(A) / P(B). Here that is 0.9 × 0.02 / (67/1000) = 0.018 / 0.067 ≈ 0.27.

Why use 1,000 people instead of probabilities?

Whole-number counts are easier to picture and to check than long decimals, and they reduce the chance of dividing by the wrong total.

Get started

DuckyHelper can
do more

It sees your screen and works in any app you use. Try it for 10 minutes, no card.

Get it for Mac, Windows or Linux

Share

Questions and jobs

Do anything

Ask it a question or hand it a job, in any app.

Doing jobs for you is in early access on Mac. Asking works on Mac, Windows and Linux.