3

I read How to calculate specificity from accuracy and sensitivity, but I have two diagnostic performance measures more. Please correct me if I am wrong: if

  • Sensitivity=TP/(TP+FN)
  • Specificity=TN/(TN+FP)
  • Positive predictive value=TP/(TP+FP)
  • Negative predictive value=TN/(TN+FN)
  • Accuracy=(TP+TN)/(TP+TN+FP+FN)
  • Cohen's kappa=1-[(1-Po)/(1-Pe)]

Can I calculate the accuracy if I know the sensitivity, specificity, positive and negative predictive values? Can I calculate the Cohen's kappa too?

Unfortunately, that situation could happen if you read an abstract of a scientific work.

(I use R)

statisticianwannabe
  • 475
  • 1
  • 6
  • 14

1 Answers1

2

You generally know TP, FN, FP, and TN, so based on this wiki:

Po = (TP + TN) / (TP + TN + FP + FN),

Pe = ((TP + FN) * (TP + FP) + (FP + TN) * (FN + TN)) / (TP + TN + FP + FN)^2

Kappa = (Po - Pe) / (1 - Pe)

Our friend Wolfram can then help to simplify this, leading to:

Kappa = 2 * (TP * TN - FN * FP) / (TP * FN + TP * FP + 2 * TP * TN + FN^2 + FN * TN + FP^2 + FP * TN)

So in R, the function would be:

cohens_kappa <- function(TP, FN, FP, TN) {
  return(2 * (TP * TN - FN * FP) / (TP * FN + TP * FP + 2 * TP * TN + FN^2 + FN * TN + FP^2 + FP * TN))
}
YvanR
  • 121
  • Thank you for your answer. Unfortunately, I generally know TP, TN, FP and FN, but sometimes I do not if I am reading an abstract of a scientific work and I have only the sensitivity, specificity, positive and negative predictive values – statisticianwannabe Nov 16 '19 at 21:30