Pipas
Pipas

Reputation: 91

Print AUC in my multiple ROC Curves from ggroc

this is my 3 ROC Curves !

rocs <- list()
rocs[["modele1"]] <- roc(data3$USI3, predict(modele1))
rocs[["modele2"]] <- roc(data3$USI3, predict(modele2))
rocs[["modele3"]] <- roc(data3$USI3, predict(modele3))
ggroc (rocs, legacy.axes = TRUE)

enter image description here

How can I directly integrate the AUC values ​​of the 3 models in the “name” part? Thanks !

Upvotes: 1

Views: 59

Answers (1)

Yacine Hajji
Yacine Hajji

Reputation: 1499

Please find an a reproducible example using the aSAH dataset.

It will also work with your data.

The idea is to modify the name of each component of your list, computing the AUC.

##### Initiating data
data(aSAH)

##### Initiating ROC curves
rocs <- list()
rocs[[1]] <- roc(aSAH$outcome, aSAH$s100b)
rocs[[2]] <- roc(aSAH$outcome, aSAH$wfns)

##### Modifying list names
for(i in 1:length(rocs)){
  names(rocs)[i] <- paste("modele", i, "AUC=", round(auc(rocs[[i]]), 2))
}

##### Display results
ggroc (rocs, legacy.axes=TRUE)

enter image description here

Upvotes: 2

Related Questions