As an example I have a confusion matrix that shows good accuracy but poor performance on sensitivity because of imbalanced classes. I made this fictive table for a presentation.

                actual          actual
               positive        negative
pred. positive      6              20
pred. negative      6              986

I have two questions:

First, is it possible to draw a ROC curve that matches with this confusion matrix and how to do this without having the original data? Is there an easy/short way or should I somehow reconstruct some "fictive" data.

Second, could different ROC curves potentially match with the same confusion matrix? I thought that classification thresholds may differ and therefore may result in different ROC curves with similar confusion matrix (see Fawcett 2006.

For implementation I am using the ROCR package in R.


This matrix is just a point on your ROC curve obtained for the threshold you picked. You can compute a value of sensitivity and specificity with your matrix, this is where you point is. $$sensitivity=6/12=1/2$$ $$1-specificity=986/1006=0.98$$ Many different ROC curves could then cross this point. If you can move this threshold, you can draw your ROC curve.

The whole point of ROC curves is to see how sensitivity and specificity vary across various threshold.

  • $\begingroup$ Could you please explain about the threshold? Would be great if you give some numeric example. Tks. $\endgroup$ – Jefferson Mendonca Nov 3 '17 at 0:40
  • $\begingroup$ It's not clear what you want explained here. Perhaps you should ask a new question; you can link back to this one if you need it for context. $\endgroup$ – Glen_b Nov 3 '17 at 1:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.