{"success":true,"version":"v1","request":{"tool":"get_calculator_schema","calculator_id":"diagnostic-test"},"result":{"entity_type":"calculator","id":"diagnostic-test","calculator_id":"diagnostic-test","canonical_url":"https://tttkmbb.com/statistics/diagnostic-test","name":"Diagnostic Test Calculator","title":"Diagnostic Test Calculator – PPV, NPV, Likelihood Ratios and Post-Test Probability from Sensitivity, Specificity and Prevalence","category":"statistics","category_name":"Statistics & Probability","tool_name":"calculate_diagnostic_test_predictive_values","featured_mcp_tool":false,"description":"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.","use_when":"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.","inputs":[{"name":"sensitivity_percent","label":"Sensitivity","type":"number","unit":"%","required":true,"min":0,"max":100,"description":"Percentage of people with the condition who test positive (true positive rate).","example":90},{"name":"specificity_percent","label":"Specificity","type":"number","unit":"%","required":true,"min":0,"max":100,"description":"Percentage of people without the condition who test negative (true negative rate).","example":95},{"name":"prevalence_percent","label":"Prevalence (pre-test probability)","type":"number","unit":"%","required":true,"exclusive_min":0,"exclusive_max":100,"description":"Percentage of the tested population that has the condition.","example":1}],"outputs":[{"name":"ppv_percent","label":"Positive predictive value","type":"number","unit":"%","decimals":2,"description":"Probability of having the condition given a positive result (post-test probability after a positive)."},{"name":"npv_percent","label":"Negative predictive value","type":"number","unit":"%","decimals":2,"description":"Probability of not having the condition given a negative result."},{"name":"post_test_probability_negative_percent","label":"Post-test probability after a negative","type":"number","unit":"%","decimals":2,"description":"100 − NPV: probability of the condition despite a negative result."},{"name":"likelihood_ratio_positive","label":"LR+","type":"number","decimals":4,"description":"sensitivity / (1 − specificity); > 10 is a strong positive result (omitted when specificity is 100 %)."},{"name":"likelihood_ratio_negative","label":"LR−","type":"number","decimals":4,"description":"(1 − sensitivity) / specificity; < 0.1 is a strong negative result (omitted when specificity is 0 %)."},{"name":"true_positives_per_1000","label":"True positives per 1,000","type":"number","decimals":1,"description":"People with the condition who test positive, per 1,000 tested."},{"name":"false_negatives_per_1000","label":"False negatives per 1,000","type":"number","decimals":1,"description":"People with the condition who test negative."},{"name":"false_positives_per_1000","label":"False positives per 1,000","type":"number","decimals":1,"description":"People without the condition who test positive."},{"name":"true_negatives_per_1000","label":"True negatives per 1,000","type":"number","decimals":1,"description":"People without the condition who test negative."},{"name":"accuracy_percent","label":"Accuracy","type":"number","unit":"%","decimals":2,"description":"(true positives + true negatives) / all tested."}],"input_schema":{"type":"object","properties":{"sensitivity_percent":{"description":"Percentage of people with the condition who test positive (true positive rate). Unit: %.","type":"number","minimum":0,"maximum":100,"examples":[90],"x-unit":"%"},"specificity_percent":{"description":"Percentage of people without the condition who test negative (true negative rate). Unit: %.","type":"number","minimum":0,"maximum":100,"examples":[95],"x-unit":"%"},"prevalence_percent":{"description":"Percentage of the tested population that has the condition. Unit: %.","type":"number","exclusiveMinimum":0,"exclusiveMaximum":100,"examples":[1],"x-unit":"%"}},"additionalProperties":false,"required":["sensitivity_percent","specificity_percent","prevalence_percent"]},"output_schema":{"type":"object","properties":{"ppv_percent":{"description":"Probability of having the condition given a positive result (post-test probability after a positive). Unit: %.","type":"number","x-unit":"%"},"npv_percent":{"description":"Probability of not having the condition given a negative result. Unit: %.","type":"number","x-unit":"%"},"post_test_probability_negative_percent":{"description":"100 − NPV: probability of the condition despite a negative result. Unit: %.","type":"number","x-unit":"%"},"likelihood_ratio_positive":{"description":"sensitivity / (1 − specificity); > 10 is a strong positive result (omitted when specificity is 100 %).","type":"number"},"likelihood_ratio_negative":{"description":"(1 − sensitivity) / specificity; < 0.1 is a strong negative result (omitted when specificity is 0 %).","type":"number"},"true_positives_per_1000":{"description":"People with the condition who test positive, per 1,000 tested.","type":"number"},"false_negatives_per_1000":{"description":"People with the condition who test negative.","type":"number"},"false_positives_per_1000":{"description":"People without the condition who test positive.","type":"number"},"true_negatives_per_1000":{"description":"People without the condition who test negative.","type":"number"},"accuracy_percent":{"description":"(true positives + true negatives) / all tested. Unit: %.","type":"number","x-unit":"%"}}},"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","method":"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.","sources":[{"name":"Altman DG, Bland JM (1994) Diagnostic tests 2: predictive values, BMJ 309:102","url":"https://www.bmj.com/content/309/6947/102","type":"peer_reviewed","retrieved_at":"2026-09-24"},{"name":"Deeks JJ, Altman DG (2004) Diagnostic tests 4: likelihood ratios, BMJ 329:168-169","url":"https://www.bmj.com/content/329/7458/168","type":"peer_reviewed","retrieved_at":"2026-09-24"},{"name":"Wikipedia – Sensitivity and specificity","url":"https://en.wikipedia.org/wiki/Sensitivity_and_specificity","type":"reference","retrieved_at":"2026-09-24"}],"freshness":{"type":"static","max_age_seconds":null,"note":"Deterministic formula with fixed constants; results never go stale. Inputs supplied by the caller determine the output."},"examples":[{"name":"Screening: sensitivity 90 %, specificity 95 %, prevalence 1 %","inputs":{"sensitivity_percent":90,"specificity_percent":95,"prevalence_percent":1},"expected":{"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},"url":"https://tttkmbb.com/api/v1/calculate/diagnostic-test?sensitivity_percent=90&specificity_percent=95&prevalence_percent=1"},{"name":"Symptomatic patients: sensitivity 95 %, specificity 90 %, prevalence 30 %","inputs":{"sensitivity_percent":95,"specificity_percent":90,"prevalence_percent":30},"expected":{"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},"url":"https://tttkmbb.com/api/v1/calculate/diagnostic-test?sensitivity_percent=95&specificity_percent=90&prevalence_percent=30"}],"faq":[{"q":"Why is the PPV only 15 % with a 95 % specific test?","a":"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."},{"q":"How do I use the likelihood ratios?","a":"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."}],"tags":["positive predictive value","negative predictive value","sensitivity specificity","likelihood ratio","post-test probability","screening test"],"related":[{"calculator_id":"bayes-theorem","reason":"Same calculation with probabilities as fractions."},{"calculator_id":"odds-ratio","reason":"Association measures for a 2×2 exposure table."}],"links":{"html":"https://tttkmbb.com/statistics/diagnostic-test","markdown":"https://tttkmbb.com/statistics/diagnostic-test.md","json":"https://tttkmbb.com/statistics/diagnostic-test.json","api":"https://tttkmbb.com/api/v1/calculate/diagnostic-test","schema":"https://tttkmbb.com/api/v1/calculators/diagnostic-test","openapi":"https://tttkmbb.com/openapi.json","mcp":"https://tttkmbb.com/mcp"},"version":"v1","updated_at":"2026-09-24"},"timestamp":"2026-09-24T01:57:59Z"}