如何在逻辑回归中得到ROC的最优截止点作为数字

mql*_*ner 7 r roc

我想在逻辑回归中得到ROC的最佳截止点作为数字而不是两条交叉曲线.使用下面的代码,我可以得到将显示最佳点的图,但在某些情况下,我只需要将该点作为可用于其他计算的数字.以下是代码行:

library(Epi)
ROC( form = IsVIP ~ var1+var2+var3+var4+var5, plot="sp", data=vip_data ) 
Run Code Online (Sandbox Code Playgroud)

谢谢

adi*_*der 12

根据文档,最佳截止点定义为灵敏度+特异性最大的点(参见MX参数?ROC).您可以按如下方式获取相应的值(参见示例?ROC):

x <- rnorm(100)
z <- rnorm(100)
w <- rnorm(100)
tigol <- function(x) 1 - (1 + exp(x))^(-1)
y <- rbinom(100, 1, tigol(0.3 + 3*x + 5*z + 7*w))
rc <- ROC(form = y ~ x + z, plot="sp") 
## optimal combination
opt <- which.max(rowSums(rc$res[, c("sens", "spec")]))
## optimal cut-off point 
rc$res$lr.eta[opt]
Run Code Online (Sandbox Code Playgroud)

这是您运行时将显示的点

ROC(form = y ~ x + z, plot = "ROC", MX = TRUE)
Run Code Online (Sandbox Code Playgroud)