Learn R Programming

MetricsWeighted (version 0.1.0)

AUC: Area under the ROC

Description

Weighted AUC, i.e. the area under the receiver operating curve, based on a deterministic version of glmnet::auc. Note that the unweighted version can be different from the weighted one with unit weights due to ties in predicted.

Usage

AUC(actual, predicted, w = NULL, ...)

Arguments

actual

Observed values (0 or 1).

predicted

Predicted values (not necessarly between 0 and 1).

w

Optional case weights.

...

Further arguments passed by other methods.

Value

A numeric vector of length one.

See Also

gini_coefficient.

Examples

Run this code
# NOT RUN {
AUC(c(0, 0, 1, 1), c(0.1, 0.1, 0.9, 0.8))
AUC(c(1, 0, 0, 1), c(0.1, 0.1, 0.9, 0.8))
AUC(c(1, 0, 0, 1), 2 * c(0.1, 0.1, 0.9, 0.8))
AUC(c(1, 0, 0, 1), c(0.1, 0.1, 0.9, 0.8), w = rep(1, 4)) # different from last due to ties
AUC(c(1, 0, 0, 1), c(0.1, 0.2, 0.9, 0.8))
AUC(c(1, 0, 0, 1), c(0.1, 0.2, 0.9, 0.8), w = rep(1, 4)) # same as last (no ties)
AUC(c(0, 0, 1, 1), c(0.1, 0.1, 0.9, 0.8), w = 1:4)

# }

Run the code above in your browser using DataLab