The auc function takes an S3 object generated by part and evalmod and retrieves a data frame with the partial AUC scores of ROC and Precision-Recall curves.

pauc(curves)

# S3 method for class 'aucs'
pauc(curves)

Arguments

curves

An S3 object generated by part and evalmod. The pauc function accepts the following S3 objects.

S3 object# of models# of test datasets
sscurvessinglesingle
mscurvesmultiplesingle
smcurvessinglemultiple
mmcurvesmultiplemultiple

See the Value section of evalmod for more details.

Value

The auc function returns a data frame with pAUC scores.

See also

evalmod for generating S3 objects with performance evaluation measures. part for calculation of pAUCs. auc for retrieving a dataset of AUCs.

Examples


##################################################
### Single model & single test dataset
###

## Load a dataset with 10 positives and 10 negatives
data(P10N10)

## Generate an sscurve object that contains ROC and Precision-Recall curves
sscurves <- evalmod(scores = P10N10$scores, labels = P10N10$labels)

## Calculate partial AUCs
sscurves.part <- part(sscurves, xlim = c(0.25, 0.75))

## Shows pAUCs
pauc(sscurves.part)
#>   modnames dsids curvetypes     paucs    spaucs
#> 1       m1     1        ROC 0.3771875 0.7543750
#> 2       m1     1        PRC 0.3616708 0.7233417

##################################################
### Multiple models & single test dataset
###

## Create sample datasets with 100 positives and 100 negatives
samps <- create_sim_samples(1, 100, 100, "all")
mdat <- mmdata(samps[["scores"]], samps[["labels"]],
  modnames = samps[["modnames"]]
)

## Generate an mscurve object that contains ROC and Precision-Recall curves
mscurves <- evalmod(mdat)

## Calculate partial AUCs
mscurves.part <- part(mscurves, xlim = c(0, 0.75), ylim = c(0.25, 0.75))

## Shows pAUCs
pauc(mscurves.part)
#>    modnames dsids curvetypes     paucs    spaucs
#> 1    random     1        ROC 0.0878000 0.2341333
#> 2    random     1        PRC 0.1495042 0.3986777
#> 3   poor_er     1        ROC 0.3028000 0.8074667
#> 4   poor_er     1        PRC 0.3748271 0.9995389
#> 5   good_er     1        ROC 0.2990000 0.7973333
#> 6   good_er     1        PRC 0.3626852 0.9671606
#> 7     excel     1        ROC 0.3677000 0.9805333
#> 8     excel     1        PRC 0.3750000 1.0000000
#> 9      perf     1        ROC 0.3750000 1.0000000
#> 10     perf     1        PRC 0.3750000 1.0000000

##################################################
### Single model & multiple test datasets
###

## Create sample datasets with 100 positives and 100 negatives
samps <- create_sim_samples(4, 100, 100, "good_er")
mdat <- mmdata(samps[["scores"]], samps[["labels"]],
  modnames = samps[["modnames"]],
  dsids = samps[["dsids"]]
)

## Generate an smcurve object that contains ROC and Precision-Recall curves
smcurves <- evalmod(mdat, raw_curves = TRUE)

## Calculate partial AUCs
smcurves.part <- part(smcurves, xlim = c(0.25, 0.75))

## Shows pAUCs
pauc(smcurves.part)
#>   modnames dsids curvetypes     paucs    spaucs
#> 1  good_er     1        ROC 0.4265000 0.8530000
#> 2  good_er     1        PRC 0.4233741 0.8467483
#> 3  good_er     2        ROC 0.4368000 0.8736000
#> 4  good_er     2        PRC 0.4687105 0.9374211
#> 5  good_er     3        ROC 0.4188000 0.8376000
#> 6  good_er     3        PRC 0.4204513 0.8409027
#> 7  good_er     4        ROC 0.4232000 0.8464000
#> 8  good_er     4        PRC 0.4557503 0.9115005

##################################################
### Multiple models & multiple test datasets
###

## Create sample datasets with 100 positives and 100 negatives
samps <- create_sim_samples(4, 100, 100, "all")
mdat <- mmdata(samps[["scores"]], samps[["labels"]],
  modnames = samps[["modnames"]],
  dsids = samps[["dsids"]]
)

## Generate an mscurve object that contains ROC and Precision-Recall curves
mmcurves <- evalmod(mdat, raw_curves = TRUE)

## Calculate partial AUCs
mmcurves.part <- part(mmcurves, xlim = c(0, 0.25))

## Shows pAUCs
pauc(mmcurves.part)
#>    modnames dsids curvetypes      paucs    spaucs
#> 1    random     1        ROC 0.01850000 0.0740000
#> 2    random     1        PRC 0.08953401 0.3581360
#> 3   poor_er     1        ROC 0.11170000 0.4468000
#> 4   poor_er     1        PRC 0.21302642 0.8521057
#> 5   good_er     1        ROC 0.14020000 0.5608000
#> 6   good_er     1        PRC 0.25000000 1.0000000
#> 7     excel     1        ROC 0.21380000 0.8552000
#> 8     excel     1        PRC 0.25000000 1.0000000
#> 9      perf     1        ROC 0.25000000 1.0000000
#> 10     perf     1        PRC 0.25000000 1.0000000
#> 11   random     2        ROC 0.02960000 0.1184000
#> 12   random     2        PRC 0.11552352 0.4620941
#> 13  poor_er     2        ROC 0.10530000 0.4212000
#> 14  poor_er     2        PRC 0.22490831 0.8996333
#> 15  good_er     2        ROC 0.14880000 0.5952000
#> 16  good_er     2        PRC 0.25000000 1.0000000
#> 17    excel     2        ROC 0.24040000 0.9616000
#> 18    excel     2        PRC 0.25000000 1.0000000
#> 19     perf     2        ROC 0.25000000 1.0000000
#> 20     perf     2        PRC 0.25000000 1.0000000
#> 21   random     3        ROC 0.02410000 0.0964000
#> 22   random     3        PRC 0.11096931 0.4438773
#> 23  poor_er     3        ROC 0.09510000 0.3804000
#> 24  poor_er     3        PRC 0.17398022 0.6959209
#> 25  good_er     3        ROC 0.15660000 0.6264000
#> 26  good_er     3        PRC 0.25000000 1.0000000
#> 27    excel     3        ROC 0.23810000 0.9524000
#> 28    excel     3        PRC 0.25000000 1.0000000
#> 29     perf     3        ROC 0.25000000 1.0000000
#> 30     perf     3        PRC 0.25000000 1.0000000
#> 31   random     4        ROC 0.03760000 0.1504000
#> 32   random     4        PRC 0.12427433 0.4970973
#> 33  poor_er     4        ROC 0.08250000 0.3300000
#> 34  poor_er     4        PRC 0.19368209 0.7747284
#> 35  good_er     4        ROC 0.15300000 0.6120000
#> 36  good_er     4        PRC 0.25000000 1.0000000
#> 37    excel     4        ROC 0.23570000 0.9428000
#> 38    excel     4        PRC 0.25000000 1.0000000
#> 39     perf     4        ROC 0.25000000 1.0000000
#> 40     perf     4        PRC 0.25000000 1.0000000