plotting ROC in R with ROCR vs pROC

非 Y 不嫁゛ 提交于 2019-12-02 20:25:53

To confirm, you are right in that true positive rate = sensitivity and false positive rate = 1 - specificity. In your example, the order in which you plot components of the ROCR performance object from the ROCR package is key. In the last line, the first performance measure, true positive rate, 'tpr' gets plotted on the y-axis measure = 'tpr' and the second performance measure, false positive rate, is plotted on the x-axis x.measure = 'fpr'

plot(performance(ROCRpred, measure = 'tpr', x.measure = 'fpr'))
PharmR

Just to say, for the pROC package if you include the following in your plot code:

plot(roc(obs,pred), legacy.axes = TRUE)

then you end up with a reversed x-axis.

angelous

As far as I know:

TPR = sensitivity = TP/(TP/FN) -> y axis: [0, 1]

FPR = 1 - specificity = 1 - (TN/(FP+TN)) -> x axis: [0, 1]

But, when the graph shows specificity (true negative rate) in the x-axis then the range is [1, 0].

In both cases, the graph is the same.

You can check it here in wikipedia page.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!