user53020 user53020 - 1 year ago 83
R Question

R error in calculating AUC value from pROC package

I am trying to use the

package in R to calculate sensitivity, specificity and threshold level. Here is a sample data

coords(myroc, "best", ret=c("threshold", "sensitivity", "specificity"))

Error in UseMethod("coords") :
no applicable method for 'coords' applied to an object of class "c('double', 'numeric')"

Will anyone be able to tell me why this error is happening and how to fix it?

Thank you

Answer Source

Here is my best guess: the roc function name is used in several packages (11 on CRAN at the moment according to the sos package) and those will take precedence over pROC if they are loaded later in your session. By restarting R you cleared that function from your search path and are back to using pROC's roc.

To ensure you are using pROC's roc function, use the following syntax:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download