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 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.1419000 0.3784000
#> 2    random     1        PRC 0.2258450 0.6022533
#> 3   poor_er     1        ROC 0.3130000 0.8346667
#> 4   poor_er     1        PRC 0.3739481 0.9971950
#> 5   good_er     1        ROC 0.3097000 0.8258667
#> 6   good_er     1        PRC 0.3655041 0.9746776
#> 7     excel     1        ROC 0.3727000 0.9938667
#> 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.4072000 0.8144000
#> 2  good_er     1        PRC 0.4342177 0.8684353
#> 3  good_er     2        ROC 0.4138000 0.8276000
#> 4  good_er     2        PRC 0.4392181 0.8784363
#> 5  good_er     3        ROC 0.3907000 0.7814000
#> 6  good_er     3        PRC 0.4182098 0.8364195
#> 7  good_er     4        ROC 0.4050000 0.8100000
#> 8  good_er     4        PRC 0.4321187 0.8642374

##################################################
### 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.0324000 0.1296000
#> 2    random     1        PRC 0.1148775 0.4595100
#> 3   poor_er     1        ROC 0.0810000 0.3240000
#> 4   poor_er     1        PRC 0.1737708 0.6950832
#> 5   good_er     1        ROC 0.1045000 0.4180000
#> 6   good_er     1        PRC 0.2458400 0.9833601
#> 7     excel     1        ROC 0.2278000 0.9112000
#> 8     excel     1        PRC 0.2500000 1.0000000
#> 9      perf     1        ROC 0.2500000 1.0000000
#> 10     perf     1        PRC 0.2500000 1.0000000
#> 11   random     2        ROC 0.0541000 0.2164000
#> 12   random     2        PRC 0.1845236 0.7380944
#> 13  poor_er     2        ROC 0.0919000 0.3676000
#> 14  poor_er     2        PRC 0.2068986 0.8275943
#> 15  good_er     2        ROC 0.1528000 0.6112000
#> 16  good_er     2        PRC 0.2500000 1.0000000
#> 17    excel     2        ROC 0.2299000 0.9196000
#> 18    excel     2        PRC 0.2500000 1.0000000
#> 19     perf     2        ROC 0.2500000 1.0000000
#> 20     perf     2        PRC 0.2500000 1.0000000
#> 21   random     3        ROC 0.0388000 0.1552000
#> 22   random     3        PRC 0.1630154 0.6520615
#> 23  poor_er     3        ROC 0.0595000 0.2380000
#> 24  poor_er     3        PRC 0.1756503 0.7026013
#> 25  good_er     3        ROC 0.1382000 0.5528000
#> 26  good_er     3        PRC 0.2500000 1.0000000
#> 27    excel     3        ROC 0.2317000 0.9268000
#> 28    excel     3        PRC 0.2500000 1.0000000
#> 29     perf     3        ROC 0.2500000 1.0000000
#> 30     perf     3        PRC 0.2500000 1.0000000
#> 31   random     4        ROC 0.0602000 0.2408000
#> 32   random     4        PRC 0.1589261 0.6357043
#> 33  poor_er     4        ROC 0.1074000 0.4296000
#> 34  poor_er     4        PRC 0.2461646 0.9846584
#> 35  good_er     4        ROC 0.1290000 0.5160000
#> 36  good_er     4        PRC 0.2382133 0.9528533
#> 37    excel     4        ROC 0.2287000 0.9148000
#> 38    excel     4        PRC 0.2487740 0.9950959
#> 39     perf     4        ROC 0.2500000 1.0000000
#> 40     perf     4        PRC 0.2500000 1.0000000