Search code examples
rrocmultinomialnnetproc-r-package

How can I add a title to multiclass.roc plots in pROC?


I have a multinomial model constructed with nnet:multinom of 5 classes for 26 variables:

mirna_multinom_0 = multinom(formula_0, data= clase_training, maxit=10000 )

And then I create my ROCS with:

multiclass.roc(clase_training$clase, mirna_multinom_0$fitted.values,plot=TRUE)

Which I plot.

pred_test_inter_multinom_5 = predict(interaction_multinom_model_5, newdata = clase_test, "probs")
multiclass.roc(clase_test$clase, pred_test_inter_multinom_5,plot=TRUE)

Plot of first contrast Ctrl vs Group1

To understand them I store it as an object e and call the contrast as names(e$roc) to see my contrasts.

e = multiclass.roc(clase_training$clase, mirna_multinom_0$fitted.values)
names(e$rocs)

 [1] "Control/Idiop_grave"      "Control/Idiop_leve"       "Control/Isquem_grave"    
 [4] "Control/Isquem_leve"      "Idiop_grave/Idiop_leve"   "Idiop_grave/Isquem_grave"
 [7] "Idiop_grave/Isquem_leve"  "Idiop_leve/Isquem_grave"  "Idiop_leve/Isquem_leve"  
[10] "Isquem_grave/Isquem_leve"

Which gives me 2 plots for each of them, 1 in > direction and the other in < direction.

Now. Can I plot the titles of each contrast in the plots in someway?

And also, is there a way I can obtain the areas under the curve AUC for each one of the ROC contrast? I only obtain it in a message for the multinomial. Which don't have a PROC plot. Can I obtain a multinomial ROC, or its just a construct with no graphical representation?


Solution

  • Can I plot the titles of each contrast in the plots in someway?

    You will need to loop over the curves yourself, but it can be done easily like:

    for (contrast in names(e$rocs)) {
        plot(e$rocs[[contrast]][[1]], col = "green", main = contrast)
        plot(e$rocs[[contrast]][[2]], col = "blue", add = TRUE)
    }
    

    is there a way I can obtain the areas under the curve AUC for each one of the ROC contrast?

    You can do something similar with the auc function:

    for (contrast in names(e$rocs)) {
        print(contrast)
        print(auc(e$rocs[[contrast]][[1]]))
        print(auc(e$rocs[[contrast]][[2]]))
    }
    

    Can I obtain a multinomial ROC, or its just a construct with no graphical representation?

    It is a sort of average of AUC described by Hand & Till in doi:10.1023/A:1010920819831. There is no corresponding curve to be represented.