Diagnostic Test Calculator
- A diagnostic test is graded on its 2x2 table: sensitivity is the share of diseased people the test catches, TP over TP plus FN, and specificity is the share of healthy people it clears, TN over TN plus FP. Those two are properties of the test itself.
- From 90 true positives, 10 false positives, 5 false negatives and 95 true negatives, sensitivity is 94.74% and specificity is 90.48%. The positive likelihood ratio is 9.95 and the negative likelihood ratio is 0.06.
- The predictive values answer the patient's question instead: with prevalence at 47.50% in this sample, a positive result is right 90.00% of the time and a negative result 95.00%. Move the same test to a low-prevalence population and the positive predictive value falls even though sensitivity and specificity never change.
- Likelihood ratios travel better than predictive values: multiply the pre-test odds by the positive likelihood ratio to get the post-test odds after a positive result. A ratio above 10 or below 0.1 is usually considered decisive; near 1, the test barely moves the needle.
The Diagnostic Test Calculator turns four counts from a study — true positives, false positives, false negatives and true negatives — into the numbers clinicians use to judge a test. It reports sensitivity (TP divided by TP plus FN) and specificity (TN divided by TN plus FP), then goes further: it computes positive and negative predictive values at the prevalence you enter, plus likelihood ratios. Because predictive values shift with prevalence, the calculator asks for prevalence rather than assuming one. A balanced study of 90 true positives, 10 false positives, 5 false negatives and 95 true negatives gives sensitivity of 94.74%, specificity of 90.48% and a positive likelihood ratio of 9.95.
This is the standard approach because sensitivity and specificity describe the test itself, while predictive values depend on how common the condition is in the population being tested. Screening at 5 percent prevalence with counts of 45, 55, 5 and 895 keeps sensitivity at 90.00%, yet the positive predictive value falls to 45.00%. Likelihood ratios make the same point in odds form: multiply pre-test odds by LR+ after a positive result, and a value above 10 or below 0.1 is usually decisive. A test missing a quarter of cases — 180, 20, 60, 740 — shows sensitivity of 75.00% despite specificity of 97.37% and a positive likelihood ratio of 28.50. This page shows the formula, step-by-step workings, worked examples and sources so you can check every figure yourself.
Worked examples
Balanced validation study
A balanced study of 200 gives sensitivity of 94.74% with a positive predictive value of 90 percent. (90 cases · 10 cases · 5 cases · 95 cases)
| Sensitivity | 94.74% |
| Specificity | 90.48% |
| Positive predictive value | 90.00% |
| Negative predictive value | 95.00% |
| Accuracy | 92.50% |
| Positive likelihood ratio (LR+) | 9.95 |
| Negative likelihood ratio (LR-) | 0.06 |
| Prevalence in the sample | 47.50% |
Screening a low-prevalence population
Screening at 5 percent prevalence keeps sensitivity at 90.00% but halves the positive predictive value. (45 cases · 55 cases · 5 cases · 895 cases)
| Sensitivity | 90.00% |
| Specificity | 94.21% |
| Positive predictive value | 45.00% |
| Negative predictive value | 99.44% |
| Accuracy | 94.00% |
| Positive likelihood ratio (LR+) | 15.55 |
| Negative likelihood ratio (LR-) | 0.11 |
| Prevalence in the sample | 5.00% |
Test missing a quarter of cases
A test that misses a quarter of cases shows sensitivity of 75.00% despite 97 percent specificity. (180 cases · 20 cases · 60 cases · 740 cases)
| Sensitivity | 75.00% |
| Specificity | 97.37% |
| Positive predictive value | 90.00% |
| Negative predictive value | 92.50% |
| Accuracy | 92.00% |
| Positive likelihood ratio (LR+) | 28.50 |
| Negative likelihood ratio (LR-) | 0.26 |
| Prevalence in the sample | 24.00% |
The 2x2 table
Every diagnostic test result falls into one of four boxes. A true positive (TP) is a person who has the condition and tests positive. A false positive (FP) has no condition but tests positive anyway. A false negative (FN) has the condition but tests negative, and a true negative (TN) has no condition and tests negative. Arrange those four counts in a 2x2 table and you can compute all six statistics that describe how a test performs. A diagnostic test calculator does the arithmetic, but the table is where the meaning lives.
Sensitivity is TP divided by TP plus FN: of everyone who truly has the condition, what share did the test catch? Specificity is TN divided by TN plus FP: of everyone who is truly well, what share did the test clear? These two are properties of the test itself and do not change when the disease becomes more or less common. Predictive values are different. The positive predictive value (PPV) is TP divided by TP plus FP — the chance that a positive result is real — and the negative predictive value (NPV) is TN divided by TN plus FN. Both depend on prevalence, so the same test can look strong in one setting and weak in another. The remaining two statistics are the likelihood ratios, built from sensitivity and specificity, which describe how much a result shifts the odds of disease.
The numbers make the distinction concrete. A balanced study with 90 true positives, 10 false positives, 5 false negatives and 95 true negatives gives sensitivity of 94.74%, specificity of 90.48% and a positive likelihood ratio of 9.95. Now move the same kind of test into screening at 5 percent prevalence: 45 true positives, 55 false positives, 5 false negatives and 895 true negatives. Sensitivity holds at 90.00%, as a test property should, but the positive predictive value falls to 45.00% — more than half of the positive results are false alarms. A third example shows the reverse problem. A test that misses a quarter of cases, with 180 true positives, 20 false positives, 60 false negatives and 740 true negatives, still reports specificity of 97.37% and a positive likelihood ratio of 28.50, yet its sensitivity is only 75.00%.
Likelihood ratios work on odds rather than probabilities. Take the pre-test odds of disease, multiply by the positive likelihood ratio after a positive result, and you have the post-test odds. A ratio above 10 or below 0.1 is usually decisive, shifting the odds enough to change management on its own. Intermediate values nudge the odds without settling the question.
Fill in the four cells honestly — the counts, not the percentages — and the six statistics follow. Then read them together: sensitivity and specificity tell you about the test, while predictive values tell you about the patient in front of you.
Reading the three examples
The three worked examples on this page are chosen to show different things, and reading them side by side is more instructive than reading any one alone. The first is a balanced study. With 90 true positives, 10 false positives, 5 false negatives and 95 true negatives, sensitivity comes out to 94.74% and specificity to 90.48%, and the positive likelihood ratio is 9.95. This is the cleanest setting: the group tested has a substantial share of people with the condition, so the test's own properties and its predictive values are not pulling in wildly different directions. It is the case most people picture when they think about a diagnostic test calculator, and it is the one least likely to mislead you about how the test will behave elsewhere.
The second example moves the same kind of test into low-prevalence screening, at 5 percent prevalence. The counts are 45 true positives, 55 false positives, 5 false negatives and 895 true negatives. Sensitivity holds at 90.00%, because sensitivity is a property of the test and does not care who is being tested. But the positive predictive value falls to 45.00%. In plain terms, a positive result here is close to a coin flip. Nothing about the test changed; what changed is how many people in the room actually have the condition. This is the single most common misreading of screening results, and it is why predictive values must always be reported alongside prevalence.
The third example shows a test with many misses. With 180 true positives, 20 false positives, 60 false negatives and 740 true negatives, sensitivity is only 75.00% even though specificity is 97.37% and the positive likelihood ratio is 28.50. A quarter of the cases are missed. The high specificity and the strong likelihood ratio describe how well a positive result rules the condition in, not how well the test rules it out. A negative result from this test leaves real uncertainty, and the numbers say so plainly.
Taken together, the three examples make the division of labor clear. Sensitivity is true positives over true positives plus false negatives, and specificity is true negatives over true negatives plus false positives; both are properties of the test. Predictive values depend on prevalence, so they shift when the population shifts. Likelihood ratios sit in between: they update odds, so you multiply pre-test odds by the positive likelihood ratio after a positive result, and a ratio above 10 or below 0.1 is usually decisive. Read each example for which quantity is doing the work, and the calculator's output will be much harder to misread.
- Balanced study (90, 10, 5, 95): sensitivity 94.74%, specificity 90.48%, LR+ 9.95.
- Screening at 5% prevalence (45, 55, 5, 895): sensitivity 90.00%, but positive predictive value falls to 45.00%.
- Test missing a quarter of cases (180, 20, 60, 740): sensitivity 75.00% despite specificity 97.37% and LR+ 28.50.
Why prevalence changes everything
A test's sensitivity and specificity are properties of the test itself. Sensitivity is true positives divided by true positives plus false negatives; specificity is true negatives divided by true negatives plus false positives. Neither number changes when you point the test at a different group of people. The positive predictive value — the chance that a positive result really means disease — is a different animal. It depends heavily on how common the condition is in the population being tested, and that is the fact a diagnostic test calculator is built to make visible.
Start with a balanced study population: 90 true positives, 10 false positives, 5 false negatives and 95 true negatives. This test looks strong. Sensitivity is 94.74% and specificity is 90.48%, with a positive likelihood ratio of 9.95. Move the same test to a screening setting where prevalence is 5 percent, and the counts become 45 true positives, 55 false positives, 5 false negatives and 895 true negatives. Sensitivity holds at 90.00% — the test has not changed — but the positive predictive value falls to 45.00%. More than half of the people flagged as positive do not have the condition.
The reverse problem is just as important. Consider a test that misses a quarter of cases: 180 true positives, 20 false positives, 60 false negatives and 740 true negatives. Specificity is 97.37% and the positive likelihood ratio is a striking 28.50, yet sensitivity is only 75.00%. A high likelihood ratio tells you a positive result is meaningful; it says nothing about how many cases the test walks past. Reading one number in isolation hides both failure modes.
Likelihood ratios are the bridge between the test and the person in front of you. They work on odds: multiply the pre-test odds by the positive likelihood ratio after a positive result to get the post-test odds. A likelihood ratio above 10 or below 0.1 is usually treated as decisive, while values near 1 barely move the estimate. Because prevalence sets the pre-test odds, the same test result can mean very different things in a clinic and in a mass screening program. Enter your own prevalence into a diagnostic test calculator and watch the predictive values shift — that is the lesson prevalence is trying to teach.
Likelihood ratios in practice
A likelihood ratio is the piece of a test result you carry to the bedside. It tells you how much a positive or negative result shifts the odds that a patient has the condition. The arithmetic is simple: start with your pre-test odds, multiply by LR+ after a positive result, and read off the post-test odds. Because likelihood ratios are built from sensitivity and specificity, they describe the test itself and do not change when prevalence changes. That is what makes a diagnostic test calculator useful in practice: it turns a result into a revised probability for the person in front of you.
The starting point is sensitivity, which is true positives divided by true positives plus false negatives, and specificity, which is true negatives divided by true negatives plus false positives. Predictive values behave differently because they depend on prevalence. A balanced study makes the point. With 90 true positives, 10 false positives, 5 false negatives and 95 true negatives, sensitivity is 94.74%, specificity is 90.48%, and the positive likelihood ratio is 9.95. Those are strong numbers, and in a setting where the condition is reasonably common, a positive result meaningfully raises the odds.
Change the setting and the same test looks different. Screening at 5 percent prevalence, with 45 true positives, 55 false positives, 5 false negatives and 895 true negatives, keeps sensitivity at 90.00%, but the positive predictive value falls to 45.00%. The test has not gotten worse at detecting disease; most positive results now come from a large pool of healthy people. A likelihood ratio calculator sidesteps this confusion by working in odds rather than percentages, so the shift from pre-test to post-test odds stays the same regardless of how common the condition is in your clinic.
Sensitivity alone can also mislead. A test that misses a quarter of cases, with 180 true positives, 20 false positives, 60 false negatives and 740 true negatives, shows sensitivity of 75.00% despite specificity of 97.37% and a positive likelihood ratio of 28.50. The high specificity and high LR+ mean a positive result is strong evidence, but the sensitivity means a negative result does not clear the patient. That asymmetry is exactly what likelihood ratios capture and what a single sensitivity figure hides.
At the bedside, the practical rule is that a likelihood ratio above 10 or below 0.1 is usually decisive. Multiply your pre-test odds by LR+ after a positive result, or by LR- after a negative one, and compare the post-test odds with the threshold at which you would act. If the result moves you across that threshold, it changes management; if it does not, the test added little. This is the everyday use of a diagnostic test calculator: not a verdict, but a clear, reproducible step from what you thought before the test to what you should think after it.
FAQs
How do you calculate sensitivity and specificity?
Both come from the test's 2x2 table, which sorts people by true disease status and test result. Sensitivity = TP / (TP + FN): of everyone who truly has the condition, the share the test catches. Specificity = TN / (TN + FP): of everyone who truly does not have it, the share the test correctly clears.
What is the difference between sensitivity and positive predictive value?
Sensitivity is about diseased people the test catches. Positive predictive value (PPV) is about positive results that are right. They behave very differently: PPV collapses at low prevalence, falling to 45.00% in the screening example, so a positive result there is close to a coin flip even when sensitivity looks strong.
What is a good likelihood ratio?
Likelihood ratios show how much a result shifts the odds of disease. An LR+ above 10 or an LR- below 0.1 usually changes management. A ratio near 1 means the test barely moves the odds, so the result adds little to what you already knew before testing.
Why is accuracy misleading?
Accuracy hides how common the condition is. At 5 percent prevalence, a test that calls everyone negative is 95 percent accurate and clinically useless, because it misses every person who actually has the condition. High accuracy alone does not mean a test is helpful.
What does prevalence mean here?
Prevalence is the share of the tested sample that truly has the condition. It is 47.50% in the balanced example and 5.00% in the screening example. Because it changes predictive values, the same sensitivity and specificity can give very different PPV and NPV depending on which sample you use.
Which statistic should I quote for a screening test?
It depends on the job. For ruling out, quote sensitivity and the negative predictive value, since you want confidence that a negative result is truly negative. For ruling in, quote specificity and LR+, since you want confidence that a positive result reflects real disease.