Diagnostic Test Accuracy

Diagnostic test accuracy in R from a 2×2 table — sensitivity, specificity, PPV, NPV and likelihood ratios, in base R.

Evaluate a diagnostic test or classifier from its 2×2 table.

Run the code

Everything in the video — edit it and press Run Code to run real R right here, or copy it:

Download this R script  ·  ▶ Open the full playground

When to use it. Sensitivity and specificity describe the test; predictive values depend on prevalence; likelihood ratios summarise how much a result shifts the odds of disease.

Try the diagnostic test calculator · read diagnostic accuracy in R.

Next: Cohen’s Kappa: Rater Agreement →