Nothing
#' Retrieve a data frame of pAUC scores
#'
#' The \code{auc} function takes an \code{S3} object generated by
#' \code{\link{part}} and \code{\link{evalmod}} and retrieves a data frame
#' with the partial AUC scores of ROC and Precision-Recall curves.
#'
#' @param curves An \code{S3} object generated by \code{\link{part}} and
#' \code{\link{evalmod}}. The \code{pauc} function accepts the following
#' S3 objects.
#'
#' \tabular{lll}{
#' \strong{\code{S3} object}
#' \tab \strong{# of models}
#' \tab \strong{# of test datasets} \cr
#'
#' sscurves \tab single \tab single \cr
#' mscurves \tab multiple \tab single \cr
#' smcurves \tab single \tab multiple \cr
#' mmcurves \tab multiple \tab multiple
#' }
#'
#' See the \strong{Value} section of \code{\link{evalmod}} for more details.
#'
#' @return The \code{auc} function returns a data frame with pAUC scores.
#'
#' @seealso \code{\link{evalmod}} for generating \code{S3} objects with
#' performance evaluation measures. \code{\link{part}} for calculation of
#' pAUCs. \code{\link{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)
#'
#' ##################################################
#' ### 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)
#'
#' ##################################################
#' ### 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)
#'
#' ##################################################
#' ### 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)
#'
#' @export
pauc <- function(curves) UseMethod("pauc", curves)
#' @export
pauc.default <- function(curves) {
stop("An object of unknown class is specified")
}
#
# Print AUC scores
#
#' @rdname pauc
#' @export
pauc.aucs <- function(curves) {
# Validation
.validate(curves)
if (!attr(curves, "partial")) {
stop("part() should be used first.")
}
# Return AUC scores
attr(curves, "paucs")
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.