standarddeviationcalculator.net

Updated

Diagnostic test and risk calculators

Calculators for judging how well a test or classifier performs and for comparing risk between groups. They are built for clinicians, epidemiology students and data scientists working from a 2×2 table of results or from published sensitivity, specificity and event rates.

Which calculator do I need?

You have or wantUse
TP, FP, FN and TN counts, and want sensitivity, specificity, PPV and NPV with CIsSensitivity and specificity calculator
A classifier’s confusion matrix, and want precision, recall, F1 or MCCConfusion matrix calculator
A pre-test probability and a likelihood ratioPost-test probability calculator
To see why a positive result for a rare condition is often falseFalse positive paradox calculator
The best cut-off from a table of thresholdsYouden index calculator
Event counts in exposed and unexposed groups, and want RR with a CIRelative risk calculator
Treatment and control event rates, and want ARR, RRR, odds ratio and NNTRisk calculator

Test accuracy from a 2×2 table

Summarise how often a test or classifier gets positives and negatives right.

From a test result to a probability

Turn a test’s accuracy and the base rate into the chance that a given result is right.

Comparing risk between groups

Measure how much an exposure or treatment changes the chance of an outcome.

Accuracy of the test vs meaning of the result

Sensitivity and specificity describe the test: the share of people with the condition who test positive, and the share without it who test negative. They do not change with prevalence. Positive and negative predictive values describe the result: the chance that a positive or negative is correct, and they depend heavily on how common the condition is. The sensitivity and specificity calculator gives all four from a 2×2 table; the post-test probability calculator and Bayes’ theorem calculator apply them to a patient with a given pre-test probability.

Worked example: a good test for a rare condition

A test has 99% sensitivity and 95% specificity, and 1% of people screened have the condition. Out of 10,000 people, 100 have it and 99 test positive; of the 9,900 without it, 5% or 495 test positive. So only 99 of 594 positives are true: PPV = 16.7%. The same answer comes from likelihood ratios: LR+ = 0.99 / 0.05 = 19.8, pre-test odds 1 : 99, post-test odds 0.2, probability 0.2 / 1.2 = 16.7%. Youden’s J for this test is 0.99 + 0.95 − 1 = 0.94. The false positive paradox calculator draws this as a frequency tree.

Relative and absolute risk

If 20 of 100 exposed people and 10 of 100 unexposed people develop an outcome, the relative risk is 0.20 / 0.10 = 2.0, the risk difference is 10 percentage points, and the number needed to harm is 1 / 0.10 = 10. The odds ratio from the risk calculator is (20/80) / (10/90) = 2.25: larger than the relative risk, as it always is when the outcome is common.

Common mix-ups

  • Accuracy on imbalanced data. A classifier that always says “negative” is 99% accurate when 1% are positive. Use balanced accuracy, F1 or MCC from the confusion matrix calculator.
  • Recall and sensitivity are the same thing, and precision is the PPV; the names differ between medicine and machine learning.
  • Odds ratio vs relative risk. They are close only when the outcome is rare, below about 10%.

Guides to read alongside

Common questions

Why is the positive predictive value so much lower than the sensitivity?
Because PPV depends on prevalence. When a condition is rare, even a small false-positive rate applied to the large healthy group produces more false positives than the test finds true ones.
What is a good Youden index?
J runs from 0 (no better than chance) to 1 (perfect). Values above about 0.5 are usually considered useful, but the best cut-off also depends on whether missed cases or false alarms are more costly.
Should I report relative risk or absolute risk?
Report both. A relative risk of 2 sounds large, but if the baseline risk is 1 in 10,000 the absolute increase is only 1 in 10,000; the risk difference and NNT make that visible.