partAUC: Partial Area Under the Curve

Description Usage Arguments Details Value Examples

View source: R/partial-auc-spline.R

Description

Function for estimating the partial area under the ROC curve. ROC curve may be optionally smoothed using binormal smoothing before computing partial AUC. See Details for a more comprehensive description.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
partAUC(
  data = NULL,
  sens = NULL,
  spec = NULL,
  range = c(1, 0),
  focus = "sp",
  smooth = FALSE,
  correct = FALSE,
  n = 10000,
  plot = FALSE,
  opts = list(),
  ...
)

Arguments

data

Data frame.

sens

Column name in data for sensitivity.

spec

Column name in data for specificity.

range

Range of sensitivity or specificity to integrate.

focus

String describing whether the integration range is for sensitivity or specificity.

smooth

Logical. Should binormal smoothing be used?

correct

Logical. Should a min-max correction be applied?

n

Number of equally-spaced points for smooth curve calculations.

plot

Logical. Should a partial AUC plot be returned?

opts

List of options passed to plotting function if plot = TRUE. See details.

...

Not currently used.

Details

Since the x-axis of the ROC curve is mapped as 1 - Specificity, if the focus is "sp", the range should be provided in the left-to-right orientation for specificity. In other words, if you want to integrate the entire ROC in terms of specificity, the range would be c(1,0); this translates to integrating the false-positive rate from c(0,1).

If you only want to integrate the a section of the ROC curve (e.g. FPR from 0 to 0.2), you would specify the range in terms of specificity as c(1, 0.8).

When the focus is "se" for sensitivity, the range should be specified from the top-to-bottom orientation. In other words, to integrate the whole ROC curve, if the focus is "se" the range should be specificed as c(1,0). To integrate only a section of the ROC, for example, when sensitivity is between 0 and 0.5, you would specify the focus as "se" and the range as c(0.5,0).

The list of options (opts) that can be passed to the plotting function are (passed as a list):

Value

Invisibly returns a tibble containing a column for the partial AUC, and a list-column containing the ROC data. The returned tibble inherits the tibble classes as well as the class partial_auc. The returned object also contains attributes indicating whether the ROC was smoothed (smooth_roc), corrected (corrected_auc), range of integration (range), and focus (focus).

Examples

1
2
3
4
dd <- tibble::tibble(sens = runif(100), spec = runif(100))

partAUC(dd, sens, spec, range = c(1, 0.8))
partAUC(dd, sens, spec, range = c(1, 0.8), smooth = TRUE, correct = TRUE)

mattwarkentin/precogs documentation built on Jan. 12, 2020, 6:24 p.m.