s.roc {ldt} | R Documentation |
Get ROC Curve Data for Binary Classification
Description
This function calculates the required points for plotting the ROC curve and the AUC.
Usage
s.roc(y, scores, weights = NULL, options = get.options.roc())
Arguments
y |
A numeric vector ( |
scores |
A numeric vector ( |
weights |
A numeric vector ( |
options |
A list from |
Details
This is generally a statistics helper method in this package and it shows the inner calculations. See AUC section in get.search.metrics for a discussion.
Value
A list with the following items:
n |
Number of observations. |
auc |
Value of AUC. |
points |
Points for plotting ROC. |
Examples
y <- c(1, 0, 1, 0, 1, 1, 0, 0, 1, 0)
scores <- c(0.1, 0.2, 0.3, 0.5, 0.5, 0.5, 0.7, 0.8, 0.9, 1)
res1 <- s.roc(y,scores)
costs <- c(1,2,1,4,1,5,1,1,0.5,1)
costMatrix <- matrix(c(0.02,-1,-3,3),2,2)
opt <- get.options.roc(costs = costs, costMatrix = costMatrix)
res2 <- s.roc(y,scores,NULL,options = opt)
[Package ldt version 0.5.3 Index]