(This page is scheduled for review and further development.)

You are one of...current visitors on the English part - also ...current visitors on the Swedish part

(the number of current visitors is automatically updated every 4 minutes)

Cite this page as:

-

Sensitivity / Specificity / ROC

-

First published:

on:

INFOVOICE.SE

Last updated:

If you want to share information about this web page...

This web-page provides an introduction to the concepts sensitivity, specificity and ROC-analysis. Reading this will give you an understanding of these concepts and how to use them.

You will understand this page best if you first have read Introduction to statistics, Observations and variables, Inferential statistics, Choosing statistical analysis and Agreements.

Binary Diagnostic Test Characteristics Calculator

The calculator above utilizes standard mathematical approximations to generate metrics and confidence intervals dynamically, without relying on external statistical libraries. Some of this is explained below:

Confidence intervals for proportions (Sensitivity, Specificity, PPV, NPV) are calculated using the standard Wald method. While simple, it is the most widely recognized standard for clinical estimators. The formula used for the upper and lower bounds is:

p±Zp(1p)np \pm Z \sqrt{\frac{p(1-p)}{n}}
  • p represents the calculated proportion (e.g., Sensitivity).
  • Z represents the critical Z-score associated with the user-defined confidence interval.
  • n represents the applicable sample size (e.g., total actual positives for Sensitivity).

Note: To prevent mathematically impossible bounds, the output of the Wald calculation is strictly floored at 0% and ceilinged at 100%.

To allow for custom confidence intervals (e.g., 95%, 98%, 99%), the script dynamically converts the user’s percentage into a Z-score using the Abramowitz and Stegun approximation. This highly accurate algorithm computes the inverse of the standard normal cumulative distribution function, bypassing the need for a lookup table.

Unlike proportions, likelihood ratios are not bounded between 0 and 1; they range from 0 to infinity. Calculating standard errors on a linear scale would result in statistically invalid bounds. To account for this skew, the calculator calculates the variance on a logarithmic scale. First, it calculates the standard error of the natural log of the Likelihood Ratio. For the Positive Likelihood Ratio, the formula is:

SE=1TP1TP+FN+1FP1FP+TNSE = \sqrt{\frac{1}{TP} – \frac{1}{TP+FN} + \frac{1}{FP} – \frac{1}{FP+TN}}

The confidence bounds are calculated on this log scale and then exponentiated back to the linear scale to provide the final, properly asymmetrical confidence intervals:

exp(ln(LR)±Z×SE)\exp(\ln(LR) \pm Z \times SE)