calculateROC {MetaIntegrator} | R Documentation |
Calculate ROC Curve Statistics
Description
Calculates receiver operating characteristic curve data, including AUC (using trapezoidal method). Takes only a vector of labels and a vector of predictions.
Usage
calculateROC(labels, predictions, AUConly = FALSE)
Arguments
labels |
Vector of labels; must have exactly two unique values (ie, cases and controls). |
predictions |
Vector of predictions (for instance, test scores) to be evaluated for ability to separate the two classes. Must be exactly the same length as labels. |
AUConly |
Return all ROC values, or just the AUC. |
Details
The code borrows its core ROC calculations from the ROCR package. AUC is calculated by the trapezoidal method. AUC standard errors are calculated according to Hanley's method.
Value
Assuming AUConly=F, returns a list of values:
roc |
dataframe consisting of two columns, FPR and TPR, meant for plotting |
auc |
area under the curve |
auc.CI |
95% confidence interval for AUC |
Author(s)
Timothy E. Sweeney
References
The code borrows its core ROC calculations from the ROCR package.
See Also
Examples
# expect an AUC near 0.5 with random test
labels <- c(rep(0, 500), rep(1, 500))
scores <- runif(1000)
calculateROC(labels, scores)
#With the real data, AUC should be around 0.85606
scoreResults <- calculateScore(tinyMetaObject$filterResults[[1]], tinyMetaObject$originalData[[1]])
rocRes <- calculateROC(predictions=scoreResults, labels=tinyMetaObject$originalData[[1]]$class)
print(rocRes$auc[[1]])