Evaluate a diagnostic test or classifier from its 2×2 table.
Your browser does not support embedded video. Download the video (MP4).
:::
Everything in the video, ready to copy:
# Diagnostic test accuracy from a 2x2 table # test positive: TP true, FP false ; test negative: FN, TN TP <- 90; FP <- 10 FN <- 20; TN <- 80 # Sensitivity & specificity sensitivity <- TP / (TP + FN) specificity <- TN / (TN + FP) c(sensitivity = sensitivity, specificity = specificity) # Predictive values PPV <- TP / (TP + FP) NPV <- TN / (TN + FN) c(PPV = PPV, NPV = NPV) # Likelihood ratios c(LR_positive = sensitivity / (1 - specificity), LR_negative = (1 - sensitivity) / specificity)
Download this R script · ▶ Practice in the 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 →