The AUC values are computed by approximation using the area of the polygons formed under the ROC curve.

auc(pred, labels, nc = 200L, nine_na = TRUE)

# S3 method for aphylo_auc
print(x, ...)

# S3 method for aphylo_auc
plot(x, y = NULL, ...)

Arguments

pred

A numeric vector with the predictions of the model. Values must range between 0 and 1.

labels

An integer vector with the labels (truth). Values should be either 0 or 1.

nc

Integer. Number of cutoffs to use for computing the rates and AUC.

nine_na

Logical. When TRUE, 9 is treated as NA.

x

An object of class aphylo_auc.

...

Further arguments passed to the method.

y

Ignored.

Value

A list:

  • tpr A vector of length nc with the True Positive Rates.

  • tnr A vector of length nc with the True Negative Rates.

  • fpr A vector of length nc with the False Positive Rates.

  • fnr A vector of length nc with the False Negative Rates.

  • auc A numeric value. Area Under the Curve.

  • cutoffs A vector of length nc with the cutoffs used.

Examples

set.seed(8381)
x   <- rdrop_annotations(raphylo(50), .3)
ans <- aphylo_mcmc(x ~ mu_d + mu_s + Pi)
#> Warning: While using multiple chains, a single initial point has been passed via `initial`: c(0.9, 0.5, 0.1, 0.05, 0.5). The values will be recycled. Ideally you would want to start each chain from different locations.
#> Convergence has been reached with 10000 steps. Gelman-Rubin's R: 1.0312. (500 final count of samples).
ans_auc <- auc(predict(ans, loo = TRUE), x[,1,drop=TRUE])
print(ans_auc)
#> Number of observations     : 35
#> Area Under The Curve (AUC) : 0.95
#> Rates can be accessed via the $ operator.
plot(ans_auc)