Connect via MCP →

Enter Calculation

Formula

Show calculation steps (4)
  1. Specificity (True Negative Rate)

    Specificity (True Negative Rate): Diagnostic Test Accuracy Calculator

    Specificity = True Negatives / Total with disease absent

  2. Positive Predictive Value (PPV)

    Positive Predictive Value (PPV): Diagnostic Test Accuracy Calculator

    PPV = True Positives / All who test positive; FP = Disease absent - test negative

  3. Negative Predictive Value (NPV)

    Negative Predictive Value (NPV): Diagnostic Test Accuracy Calculator

    NPV = True Negatives / All who test negative; FN = Disease present - test positive

  4. Prevalence

    Prevalence: Diagnostic Test Accuracy Calculator

    Prevalence = Total with disease / Total sample

Advertisement

Results

Sensitivity (true positive rate)
0.9
= 90%
Metric Ratio Percent
Specificity (true negative rate) 0.95 95%
False negative rate (FNR) 0.1 10%
False positive rate (FPR) 0.05 5%
Positive predictive value (PPV) 0.6429 64.29%
Negative predictive value (NPV) 0.9896 98.96%
Prevalence 0.0909 9.09%
Disease present Disease absent
Test positive 90 (TP) 50 (FP)
Test negative 10 (FN) 950 (TN)

What this calculator does

The Diagnostic Test Accuracy Calculator turns a 2x2 confusion matrix into the standard metrics used in epidemiology and biostatistics: sensitivity, specificity, false negative rate (FNR), false positive rate (FPR), positive predictive value (PPV), negative predictive value (NPV), and prevalence. It is a universal tool — the mathematics is identical anywhere in the world and involves no country-specific rules.

2x2 confusion matrix showing disease status versus test result with cells a, b, c, d
The 2x2 diagnostic confusion matrix: true positives (a), false positives (b), false negatives (c) and true negatives (d).

How to use it

Enter four person counts: the total number of people who actually have the disease, how many of them tested positive, the total number of people without the disease, and how many of them tested negative. From these the calculator derives the four cells of the matrix:

\(a\) (true positives) = diseased who tested positive; \(c\) (false negatives) = diseased total minus \(a\); \(d\) (true negatives) = non-diseased who tested negative; \(b\) (false positives) = non-diseased total minus \(d\).

The formulas explained

$$\text{Sensitivity} = \frac{a}{a + c}$$ measures how well the test detects disease. $$\text{Specificity} = \frac{d}{b + d}$$ measures how well it rules out disease in healthy people. \(\text{FNR} = \frac{c}{a + c} = 1 - \text{sensitivity}\), and \(\text{FPR} = \frac{b}{b + d} = 1 - \text{specificity}\). $$\text{PPV} = \frac{a}{a + b}$$ is the chance you truly have the disease given a positive result, while $$\text{NPV} = \frac{d}{c + d}$$ is the chance you are truly healthy given a negative result. $$\text{Prevalence} = \frac{a + c}{a + b + c + d}$$ is the share of diseased people in the sample and strongly influences PPV and NPV.

Advertisement
Diagram showing sensitivity and specificity as proportions within the confusion matrix columns
Sensitivity uses the diseased column (\(a/(a+c)\)); specificity uses the healthy column (\(d/(b+d)\)).

Worked example

With 100 diseased people (90 test positive) and 1000 non-diseased people (950 test negative): \(a = 90\), \(c = 10\), \(d = 950\), \(b = 50\). $$\text{Sensitivity} = \frac{90}{100} = 0.9000\ (90\%)$$ $$\text{Specificity} = \frac{950}{1000} = 0.9500\ (95\%)$$ \(\text{FNR} = 0.1000\), \(\text{FPR} = 0.0500\), $$\text{PPV} = \frac{90}{140} = 0.6429\ (64.29\%)$$ $$\text{NPV} = \frac{950}{960} = 0.9896\ (98.96\%)$$ $$\text{Prevalence} = \frac{100}{1100} = 0.0909\ (9.09\%)$$

FAQ

Why is PPV much lower than sensitivity here? Because the disease is rare (low prevalence), even a small false-positive count outweighs true positives, dragging PPV down. PPV and NPV always depend on prevalence.

What is the difference between FNR and FPR? FNR is the fraction of diseased people the test misses; FPR is the fraction of healthy people the test wrongly flags as positive.

What if a category is empty? If there are no diseased people, no non-diseased people, no positive tests or no negative tests, the corresponding ratio is mathematically undefined and is left blank.

Last updated: