1

I want to calculate sensitivity, specificity, PPV, and NPV from a confusion matrix for multiclass classification. My objective is to learn the basic concept of constructing a confusion matrix for multiclass classification and how to calculate sensitivity and specificity from a confusion matrix manually without using machine learning or other programs.

My Confusion matrix: My Confusion matrix

First, I wanted to know whether my confusion matrix looks okay

Second, how can I calculate sensitivity, specificity, PPV, and NPV for different levels for the predicted class without using any program?

Third, I want to learn what's the best way to present sensitivity and specificity in a confusion matrix.

SUZ
  • 11
  • 1
    Please provide enough code so others can better understand or reproduce the problem. –  Jan 21 '23 at 06:30
  • 1
    Remark 1. Strictly speaking, term "confusion matrix" is always 2x2 (with TP, FP, FN, TN counts). Yours multiclass classification table should be better called just a cross-tabulation of counts. Remark 2. The four statistics you request come out of confusion matrix. That means you have to select, one at a time, the class of interest (focal class) and merge all the rest 5 classes, considering them as "the other class". Then you have the 2x2 confusion matrix to compute the statistics relative that focal class. – ttnphns Jan 23 '23 at 19:46
  • (cont.) Then you may turn to another focal class, and so on. Afterwards, you may average the six instances of a statistic. The averaging can be done in various ways (e.g. arithmetic mean, harmonic mean, etc., and can be weighted or unweighted.) – ttnphns Jan 23 '23 at 19:47
  • There exist other statistics for multiclass agreement, such Cohen's kappa, Brennan-Prediger's kappa, and so on, which are computed once for all the k classes. But not the four statistics you ask about. See also: https://stats.stackexchange.com/q/586342/3277 – ttnphns Jan 23 '23 at 19:51
  • @ttnphns thank you so much for your detailed explanation. Could you please tell me how I can make ROC curves from this calculation? What other information do I need to construct ROC curves to evaluate the overall diagnostic performance? – SUZ Jan 24 '23 at 05:29
  • Please address literature about ROC. If you have a specific question on ROC, please ask a new question about it. – ttnphns Jan 24 '23 at 06:09

0 Answers0