Home › Statistics & Probability › Diagnostic Test Calculator
Diagnostic Test Calculator
Computes positive and negative predictive values, likelihood ratios, post-test probabilities, accuracy and the expected numbers of true/false positives and negatives per 1,000 people tested from a test's sensitivity, specificity and the disease prevalence.
When to use
You know a screening or diagnostic test's sensitivity and specificity and the pre-test probability (prevalence) and want to know what a positive or negative result means for an individual.
Do not use when: You need to compute sensitivity and specificity themselves from a 2×2 table of test results (they are TP/(TP+FN) and TN/(TN+FP)), or the inputs are fractions 0–1 (use bayes-theorem). Informational; not medical advice.
Formula
per 1000: TP = 10·prev·sens/100, FN = 10·prev − TP, TN = 10·(100 − prev)·spec/100, FP = 10·(100 − prev) − TN; PPV = TP/(TP + FP); NPV = TN/(TN + FN); LR+ = sens/(100 − spec); LR− = (100 − sens)/spec; accuracy = (TP + TN)/1000
Predictive values depend strongly on prevalence: the same test has a much lower PPV in screening (low prevalence) than in symptomatic patients. Equivalent to Bayes' theorem with prevalence as the prior.
Inputs
| Parameter | Type | Unit | Required | Description |
|---|---|---|---|---|
sensitivity_percent | number | % | yes | Percentage of people with the condition who test positive (true positive rate). Range: ≥ 0, ≤ 100 |
specificity_percent | number | % | yes | Percentage of people without the condition who test negative (true negative rate). Range: ≥ 0, ≤ 100 |
prevalence_percent | number | % | yes | Percentage of the tested population that has the condition. Range: > 0 |
Outputs
| Output | Type | Unit | Description |
|---|---|---|---|
ppv_percent | number | % | Probability of having the condition given a positive result (post-test probability after a positive). |
npv_percent | number | % | Probability of not having the condition given a negative result. |
post_test_probability_negative_percent | number | % | 100 − NPV: probability of the condition despite a negative result. |
likelihood_ratio_positive | number | sensitivity / (1 − specificity); > 10 is a strong positive result (omitted when specificity is 100 %). | |
likelihood_ratio_negative | number | (1 − sensitivity) / specificity; < 0.1 is a strong negative result (omitted when specificity is 0 %). | |
true_positives_per_1000 | number | People with the condition who test positive, per 1,000 tested. | |
false_negatives_per_1000 | number | People with the condition who test negative. | |
false_positives_per_1000 | number | People without the condition who test positive. | |
true_negatives_per_1000 | number | People without the condition who test negative. | |
accuracy_percent | number | % | (true positives + true negatives) / all tested. |
Example
Screening: sensitivity 90 %, specificity 95 %, prevalence 1 %: {"sensitivity_percent":90,"specificity_percent":95,"prevalence_percent":1} → {"ppv_percent":15.38,"npv_percent":99.89,"post_test_probability_negative_percent":0.11,"likelihood_ratio_positive":18,"likelihood_ratio_negative":0.1053,"true_positives_per_1000":9,"false_negatives_per_1000":1,"false_positives_per_1000":49.5,"true_negatives_per_1000":940.5,"accuracy_percent":94.95}
Symptomatic patients: sensitivity 95 %, specificity 90 %, prevalence 30 %: {"sensitivity_percent":95,"specificity_percent":90,"prevalence_percent":30} → {"ppv_percent":80.28,"npv_percent":97.67,"likelihood_ratio_positive":9.5,"likelihood_ratio_negative":0.0556,"true_positives_per_1000":285,"false_positives_per_1000":70,"accuracy_percent":91.5}
GET https://tttkmbb.com/api/v1/calculate/diagnostic-test?sensitivity_percent=90&specificity_percent=95&prevalence_percent=1
Machine access
- API:
GET https://tttkmbb.com/api/v1/calculate/diagnostic-test(query parameters) orPOSTwith a JSON body{"inputs": {...}} - Schema: https://tttkmbb.com/api/v1/calculators/diagnostic-test · Markdown: https://tttkmbb.com/statistics/diagnostic-test.md · JSON definition: https://tttkmbb.com/statistics/diagnostic-test.json
- MCP: server
https://tttkmbb.com/mcp, toolrun_calculator with calculator_id="diagnostic-test" - OpenAPI operationId:
calculate_diagnostic_test_predictive_values - Freshness:
static. Authentication: none. Rate limit: fair use (see rate limits).
Sources
FAQ
Why is the PPV only 15 % with a 95 % specific test?
At 1 % prevalence, 990 of 1,000 people are healthy and 5 % of them (49.5) test falsely positive, against only 9 true positives; predictive values depend on prevalence, sensitivity and specificity do not.
How do I use the likelihood ratios?
Post-test odds = pre-test odds × LR. LR+ above 10 or LR− below 0.1 change the probability substantially; values near 1 make the test uninformative.
Related calculators
- Bayes' Theorem Calculator — Same calculation with probabilities as fractions.
- Odds Ratio Calculator — Association measures for a 2×2 exposure table.