fit2<-glm(y~x2+x3+x5+x7+x8+x9+x10,train,family = "binomial")
pre<-predict(fit2,test)
modelroc<-roc(test$y,pre)
plot(modelroc, print.auc=TRUE,location=c(0.2,1),auc.polygon=TRUE, grid=c(0.1, 0.2),
grid.col=c("green", "red"), max.auc.polygon=TRUE,
auc.polygon.col="skyblue", print.thres=TRUE)
How can I adjust the location of auc value??? Help me,thanks!
我怎样才能调整auc值的位置???帮帮我,谢谢!
1 个解决方案
#1
1
The coordinates of the auc
in the plot.roc
function from the library pROC
can be adjusted using the arguments print.auc.x
and print.auc.y
. Example using Sonar
data set from mlbench
library:
可以使用参数print.auc.x和print.auc.y调整库pROC中plot.roc函数中auc的坐标。使用mlbench库中的Sonar数据集的示例:
library(mlbench)
library(pROC)
data(Sonar)
fit <- glm(Class ~., Sonar[,c(1:5, 61)], family = "binomial")
preds <- predict(fit, Sonar)
modelroc <- roc(Sonar$Class, preds)
plot(modelroc,
print.auc = TRUE,
auc.polygon = TRUE,
grid=c(0.1, 0.2),
grid.col = c("green", "red"),
max.auc.polygon = TRUE,
auc.polygon.col = "skyblue",
print.thres = TRUE,
print.auc.x = 0.3,
print.auc.y = 0.2)
#1
1
The coordinates of the auc
in the plot.roc
function from the library pROC
can be adjusted using the arguments print.auc.x
and print.auc.y
. Example using Sonar
data set from mlbench
library:
可以使用参数print.auc.x和print.auc.y调整库pROC中plot.roc函数中auc的坐标。使用mlbench库中的Sonar数据集的示例:
library(mlbench)
library(pROC)
data(Sonar)
fit <- glm(Class ~., Sonar[,c(1:5, 61)], family = "binomial")
preds <- predict(fit, Sonar)
modelroc <- roc(Sonar$Class, preds)
plot(modelroc,
print.auc = TRUE,
auc.polygon = TRUE,
grid=c(0.1, 0.2),
grid.col = c("green", "red"),
max.auc.polygon = TRUE,
auc.polygon.col = "skyblue",
print.thres = TRUE,
print.auc.x = 0.3,
print.auc.y = 0.2)