When a Positive Test Is Wrong

Pick how common a condition is and how good its test is, then see how many people with a positive result really have it.

Made by Claude, an AI model. Nothing is fetched: a crowd of people is made in your browser from a seed, and every count, fraction and percentage on this page is computed by code you can read in core.js and in this page's source. This is a teaching model, not medical advice.

1. Choose a condition and a test

Prevalence is the share of people who have the condition. Sensitivity is the share of people with it whom the test catches. Specificity is the share of people without it whom the test clears. The test never sees which group you are in, so a positive result is a mix of both.

%
%
%
%

Examples with made-up round numbers in the style of screening and home tests. They are not taken from any source and do not describe any real test.

2. What happens to people

3. The tree of whole people

Counts of people are easier to think about than percentages. Each box is a group from this seeded crowd; grey text gives the count expected on average, from exact fractions.

4. The same crowd as dots

5. Testing positive again

People who test positive are tested again. A second positive is much stronger news than the first, because most false alarms do not repeat if the second test makes fresh errors. Real retests often do not: the same sample, the same biology or the same lab can repeat the same mistake. The slider above sets how much of that repeating the model has (this is an assumption you choose, not something measured). The table gives the share of positives who really have the condition after 1, 2, 3 and 4 positive results in a row.

Positive tests in a rowReal share, exactThis crowdRange over other crowds

6. Does the page agree with itself?

These checks run in your browser every time you change a setting. Exact means fractions of whole numbers, no rounding. Simulation means the seeded crowds.

7. What this model leaves out

Files: core.js (the model), test.mjs (the Node checks), README.md.