【发布时间】:2017-08-15 03:25:22
【问题描述】:
在对一组我们认为可以预测肿瘤与正常情况的分子运行逻辑回归模型后,我有以下预测。
Predicted class
T N
T 29 5
Actual class
N 993 912
我有一个分数列表,范围从预测 0(正数)。然后我的data.frame 中有另一列,表示模型预测的标签(1== 肿瘤和 0== 正常)。我尝试通过以下方式使用library(ROC) 计算 ROC:
pred = prediction(prediction, labels)
roc = performance(pred, "tpr", "fpr")
plot(roc, lwd=2, colorize=TRUE)
使用:
roc_full_data <- roc(labels, prediction)
rounded_scores <- round(prediction, digits=1)
roc_rounded <- roc(labels, prediction)
呼叫:
roc.default(response = labels, predictor = prediction)
Data: prediction in 917 controls (category 0) < 1022 cases (category1).
Area under the curve: 1
AUC 等于 1。我不确定我是否全部正确运行,或者我可能在解释我的结果时做错了什么,因为 AUC 等于 1 的情况很少见。
谁能帮帮我?
最好的
【问题讨论】:
-
你到底为这些函数提供了什么? reproducible example 会很有帮助。
-
也许你需要 gto 做一些类似
auc(roc(pred, labels))的事情?