The part function takes an S3 object generated by evalmod and calculate partial AUCs and Standardized partial AUCs of ROC and Precision-Recall curves. Standardized pAUCs are standardized to the range between 0 and 1.

part(curves, xlim = NULL, ylim = NULL, curvetype = NULL)

# S3 method for sscurves
part(curves, xlim = c(0, 1), ylim = c(0, 1), curvetype = c("ROC", "PRC"))

# S3 method for mscurves
part(curves, xlim = c(0, 1), ylim = c(0, 1), curvetype = c("ROC", "PRC"))

# S3 method for smcurves
part(curves, xlim = c(0, 1), ylim = c(0, 1), curvetype = c("ROC", "PRC"))

# S3 method for mmcurves
part(curves, xlim = c(0, 1), ylim = c(0, 1), curvetype = c("ROC", "PRC"))

Arguments

curves

An S3 object generated by evalmod. The part 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.

xlim

A numeric vector of length two to specify x range between two points in [0, 1]

ylim

A numeric vector of length two to specify y range between two points in [0, 1]

curvetype

A character vector with the following curve types.

curvetypedescription
ROCROC curve
PRCPrecision-Recall curve

Multiple curvetype can be combined, such as c("ROC", "PRC").

Value

The part function returns the same S3 object specified as input with calculated pAUCs and standardized pAUCs.

See also

evalmod for generating S3 objects with performance evaluation measures. pauc for retrieving a dataset of pAUCs.

Examples

# \dontrun{ ## Load library library(ggplot2) ################################################## ### 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)) ## Show AUCs sscurves.part
#> #> === AUCs === #> #> Model name Dataset ID Curve type AUC #> 1 m1 1 ROC 0.7200000 #> 2 m1 1 PRC 0.7397716 #> #> #> === partial AUCs === #> #> Model name Dataset ID Curve type pAUC Standardized #> 1 m1 1 ROC 0.3771875 0.7543750 #> 2 m1 1 PRC 0.3616708 0.7233417 #> #> #> === Input data === #> #> Model name Dataset ID # of negatives # of positives #> 1 m1 1 10 10 #>
## Plot partial curve plot(sscurves.part)
## Plot partial curve with ggplot autoplot(sscurves.part)
################################################## ### 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)) ## Show AUCs mscurves.part
#> #> === AUCs === #> #> Model name Dataset ID Curve type AUC #> 1 random 1 ROC 0.5069000 #> 2 random 1 PRC 0.5384987 #> 3 poor_er 1 ROC 0.8114000 #> 4 poor_er 1 PRC 0.7808159 #> 5 good_er 1 ROC 0.7531000 #> 6 good_er 1 PRC 0.7952740 #> 7 excel 1 ROC 0.9720000 #> 8 excel 1 PRC 0.9709210 #> 9 perf 1 ROC 1.0000000 #> 10 perf 1 PRC 1.0000000 #> #> #> === partial AUCs === #> #> Model name Dataset ID Curve type pAUC Standardized #> 1 random 1 ROC 0.1301000 0.3469333 #> 2 random 1 PRC 0.2185493 0.5827982 #> 3 poor_er 1 ROC 0.3070000 0.8186667 #> 4 poor_er 1 PRC 0.3733519 0.9956050 #> 5 good_er 1 ROC 0.2946000 0.7856000 #> 6 good_er 1 PRC 0.3601777 0.9604739 #> 7 excel 1 ROC 0.3708000 0.9888000 #> 8 excel 1 PRC 0.3750000 1.0000000 #> 9 perf 1 ROC 0.3750000 1.0000000 #> 10 perf 1 PRC 0.3750000 1.0000000 #> #> #> === Input data === #> #> Model name Dataset ID # of negatives # of positives #> 1 random 1 100 100 #> 2 poor_er 1 100 100 #> 3 good_er 1 100 100 #> 4 excel 1 100 100 #> 5 perf 1 100 100 #>
## Plot partial curves plot(mscurves.part)
## Plot partial curves with ggplot autoplot(mscurves.part)
################################################## ### 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) ## Calculate partial AUCs smcurves.part <- part(smcurves, xlim = c(0.25, 0.75)) ## Show AUCs smcurves.part
#> #> === AUCs === #> #> Model name Dataset ID Curve type AUC #> 1 good_er 1 ROC 0.8347000 #> 2 good_er 1 PRC 0.8678453 #> 3 good_er 2 ROC 0.8019000 #> 4 good_er 2 PRC 0.8431919 #> 5 good_er 3 ROC 0.8481000 #> 6 good_er 3 PRC 0.8797784 #> 7 good_er 4 ROC 0.8586000 #> 8 good_er 4 PRC 0.8820418 #> #> #> === partial AUCs (average curves only) === #> #> Model name Curve type pAUC Standardized #> 1 good_er ROC 0.4326713 0.8653425 #> 2 good_er PRC 0.4592858 0.9185717 #> #> #> === Input data === #> #> Model name Dataset ID # of negatives # of positives #> 1 good_er 1 100 100 #> 2 good_er 2 100 100 #> 3 good_er 3 100 100 #> 4 good_er 4 100 100 #>
## Plot partial curve plot(smcurves.part)
## Plot partial curve with ggplot autoplot(smcurves.part)
################################################## ### 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)) ## Show AUCs mmcurves.part
#> #> === AUCs === #> #> Model name Dataset ID Curve type AUC #> 1 random 1 ROC 0.5440000 #> 2 random 1 PRC 0.5796108 #> 3 poor_er 1 ROC 0.8192000 #> 4 poor_er 1 PRC 0.7566730 #> 5 good_er 1 ROC 0.7670000 #> 6 good_er 1 PRC 0.8194596 #> 7 excel 1 ROC 0.9830000 #> 8 excel 1 PRC 0.9849639 #> 9 perf 1 ROC 1.0000000 #> 10 perf 1 PRC 1.0000000 #> 11 random 2 ROC 0.4929000 #> 12 random 2 PRC 0.4956446 #> 13 poor_er 2 ROC 0.8483000 #> 14 poor_er 2 PRC 0.8165340 #> 15 good_er 2 ROC 0.8224000 #> 16 good_er 2 PRC 0.8554154 #> 17 excel 2 ROC 0.9883000 #> 18 excel 2 PRC 0.9890723 #> 19 perf 2 ROC 1.0000000 #> 20 perf 2 PRC 1.0000000 #> 21 random 3 ROC 0.4795000 #> 22 random 3 PRC 0.4827813 #> 23 poor_er 3 ROC 0.7723000 #> 24 poor_er 3 PRC 0.6955223 #> 25 good_er 3 ROC 0.7877000 #> 26 good_er 3 PRC 0.8319985 #> 27 excel 3 ROC 0.9697000 #> 28 excel 3 PRC 0.9704090 #> 29 perf 3 ROC 1.0000000 #> 30 perf 3 PRC 1.0000000 #> 31 random 4 ROC 0.4552000 #> 32 random 4 PRC 0.4904880 #> 33 poor_er 4 ROC 0.7877000 #> 34 poor_er 4 PRC 0.7158956 #> 35 good_er 4 ROC 0.8166000 #> 36 good_er 4 PRC 0.8478499 #> 37 excel 4 ROC 0.9837000 #> 38 excel 4 PRC 0.9864787 #> 39 perf 4 ROC 1.0000000 #> 40 perf 4 PRC 1.0000000 #> #> #> === partial AUCs === #> #> Model name Dataset ID Curve type pAUC Standardized #> 1 random 1 ROC 0.0512000 0.2048000 #> 2 random 1 PRC 0.1859678 0.7438711 #> 3 poor_er 1 ROC 0.1108000 0.4432000 #> 4 poor_er 1 PRC 0.1898327 0.7593310 #> 5 good_er 1 ROC 0.1328000 0.5312000 #> 6 good_er 1 PRC 0.2500000 1.0000000 #> 7 excel 1 ROC 0.2363000 0.9452000 #> 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.0305000 0.1220000 #> 12 random 2 PRC 0.1218805 0.4875222 #> 13 poor_er 2 ROC 0.1305000 0.5220000 #> 14 poor_er 2 PRC 0.2225176 0.8900705 #> 15 good_er 2 ROC 0.1486000 0.5944000 #> 16 good_er 2 PRC 0.2500000 1.0000000 #> 17 excel 2 ROC 0.2388000 0.9552000 #> 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.0303000 0.1212000 #> 22 random 3 PRC 0.1150595 0.4602380 #> 23 poor_er 3 ROC 0.0857000 0.3428000 #> 24 poor_er 3 PRC 0.1682442 0.6729769 #> 25 good_er 3 ROC 0.1361000 0.5444000 #> 26 good_er 3 PRC 0.2500000 1.0000000 #> 27 excel 3 ROC 0.2203000 0.8812000 #> 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.0295000 0.1180000 #> 32 random 4 PRC 0.1330801 0.5323203 #> 33 poor_er 4 ROC 0.0930000 0.3720000 #> 34 poor_er 4 PRC 0.1729591 0.6918366 #> 35 good_er 4 ROC 0.1526000 0.6104000 #> 36 good_er 4 PRC 0.2500000 1.0000000 #> 37 excel 4 ROC 0.2375000 0.9500000 #> 38 excel 4 PRC 0.2500000 1.0000000 #> 39 perf 4 ROC 0.2500000 1.0000000 #> 40 perf 4 PRC 0.2500000 1.0000000 #> #> #> === Input data === #> #> Model name Dataset ID # of negatives # of positives #> 1 random 1 100 100 #> 2 poor_er 1 100 100 #> 3 good_er 1 100 100 #> 4 excel 1 100 100 #> 5 perf 1 100 100 #> 6 random 2 100 100 #> 7 poor_er 2 100 100 #> 8 good_er 2 100 100 #> 9 excel 2 100 100 #> 10 perf 2 100 100 #> 11 random 3 100 100 #> 12 poor_er 3 100 100 #> 13 good_er 3 100 100 #> 14 excel 3 100 100 #> 15 perf 3 100 100 #> 16 random 4 100 100 #> 17 poor_er 4 100 100 #> 18 good_er 4 100 100 #> 19 excel 4 100 100 #> 20 perf 4 100 100 #>
## Plot partial curves plot(mmcurves.part)
## Plot partial curves with ggplot autoplot(mmcurves.part)
# }