如何在ROCit中计算ROC?
我想用ROCit来创建ROC曲线。我可以改变方向来计算ROC曲线吗 (高值与健康有关) 由于问题中没有示例,我将从如何在ROCit中计算ROC?,r,roc,R,Roc,我想用ROCit来创建ROC曲线。我可以改变方向来计算ROC曲线吗 (高值与健康有关) 由于问题中没有示例,我将从?rocit文档中的示例开始,如果我误解了您的问题,请告诉我 # Load some example data data("Diabetes") # Calculate some ROC/validation data roc_empirical <- rocit(score = Diabetes$chol, class = Diabetes$dtest,
?rocit
文档中的示例开始,如果我误解了您的问题,请告诉我
# Load some example data
data("Diabetes")
# Calculate some ROC/validation data
roc_empirical <- rocit(score = Diabetes$chol, class = Diabetes$dtest,
negref = "-") # default method empirical
roc_binormal <- rocit(score = Diabetes$chol, class = Diabetes$dtest,
negref = "-", method = "bin")
# Summarize and plot the results
summary(roc_empirical) #60/329
summary(roc_binormal)
plot(roc_empirical)
plot(roc_binormal, col = c("#00BA37", "#F8766D"),
legend = FALSE, YIndex = FALSE)
现在,如果我理解(?)您只是想翻转参考值的含义/方向,在本例中是Diabetes$dtest
我们可以使用negref
参数来实现这一点:
roc_empirical <- rocit(score = Diabetes$chol, class = Diabetes$dtest,
negref = "+") # default method empirical
roc_binormal <- rocit(score = Diabetes$chol, class = Diabetes$dtest,
negref = "+", method = "bin")
summary(roc_empirical)
summary(roc_binormal)
plot(roc_empirical)
plot(roc_binormal, col = c("#00BA37", "#F8766D"),
legend = FALSE, YIndex = FALSE)
当然,你也可以对有问题的专栏重新编码
# Load some example data
data("Diabetes")
# Calculate some ROC/validation data
roc_empirical <- rocit(score = Diabetes$chol, class = Diabetes$dtest,
negref = "-") # default method empirical
roc_binormal <- rocit(score = Diabetes$chol, class = Diabetes$dtest,
negref = "-", method = "bin")
# Summarize and plot the results
summary(roc_empirical) #60/329
summary(roc_binormal)
plot(roc_empirical)
plot(roc_binormal, col = c("#00BA37", "#F8766D"),
legend = FALSE, YIndex = FALSE)
这就是你所需要的吗?欢迎来到SO!如果你能为我们提供一个简单的例子(“”),那总是好的,因此,例如,当你说“高价值与健康相关”时,你所说的会更清楚。
roc_empirical <- rocit(score = Diabetes$chol, class = Diabetes$dtest,
negref = "+") # default method empirical
roc_binormal <- rocit(score = Diabetes$chol, class = Diabetes$dtest,
negref = "+", method = "bin")
summary(roc_empirical)
summary(roc_binormal)
plot(roc_empirical)
plot(roc_binormal, col = c("#00BA37", "#F8766D"),
legend = FALSE, YIndex = FALSE)
Empirical ROC curve
Number of postive responses : 329
Number of negative responses : 60
Area under curve : 0.353850050658561