summaryROC: ROC curve and an asymptotic confidence interval for AUC

View source: R/confIntAUC.R

summaryROCR Documentation

ROC curve and an asymptotic confidence interval for AUC

Description

This function computes the ROC curve for values of a continuous variable of a group of cases and a group of controls the. Additionally, the AUC with an asymptotic confidence interval is provided.

Usage

summaryROC(cases, controls, conf.level = 0.95)

Arguments

cases

Values of the continuous variable for the cases.

controls

Values of the continuous variable for the controls.

conf.level

Confidence level of confidence interval.

Value

x.val

1-specificity of the test, so the values on the x-axis of a ROC plot.

y.val

Sensitivity of the test, so the values on the y-axis of a ROC plot.

ppvs

Positive predictive values for each cutoff.

npvs

Negative predictive values for each cutoff.

cutoffs

Cutoffs used (basically the pooled marker values of cases and controls).

res.mat

Collects the above quantities in a matrix, including Wilson confidence intervals, computed at at confidence level conf.level.

auc

Area under the ROC curve. This is equal to the value of the Mann-Whitney test statistic.

auc.var

Variance of AUC.

auc.var.norm

Variance of AUC if data is assumed to come from a bivariate normal distribution.

lowCI

Lower limit of Wald confidence interval.

upCI

Upper limit of Wald confidence interval.

logitLowCI

Lower limit of a Wald confidence interval received on logit scale.

logitUpCI

Upper limit of a Wald confidence interval received on logit scale.

Note

The confidence intervals are only valid if observations are independent.

Author(s)

Kaspar Rufibach kaspar.rufibach@gmail.com and Andrea Riebler.

References

The original reference for the computation of the confidence interval is:

Hanley, J.A. and McNeil, B.J. (1982). The meaning and use of the area under the curve. Radiology, 143, 29–36.

See also:

Pepe, M.S. (2003) The statistical evaluation of medical tests for classification and prediction. Oxford University Press.

See Also

confIntAUCbinorm. Similar functionality is provided in the package ROCR.

Examples


## simulate data
## --------------
set.seed(1977)
controls <- rnorm(n = 50)
cases <-  rnorm(n = 40, mean = 0.5, sd = 1.5)

## summary of ROC curve
## --------------
res <- summaryROC(cases = cases, controls = controls, conf.level = 0.95)


## alternative bootstrap CI for AUC
## --------------
resBinormBoot <- confIntAUCbinorm(cases = cases, controls = controls, 
                                  conf.level = 0.95, replicates = 1000,
                                  grid = 100)

## alternative bootstrap CI for AUC 
## --------------
resBinormWald <- confIntAUCbinorm(cases = cases, controls = controls,
                                  conf.level = 0.95, method = "wald")

## display results
## --------------
str(res)
str(resBinormBoot)
str(resBinormWald)

## plot ROC curve
## --------------
plot(x = 0, y = 0, xlim = c(0, 1), ylim = c(0, 1), type = "l", 
     xlab = "1 - specificity", ylab = "sensitivity", pty = "s")
segments(x0 = 0, y0 = 0, x1 = 1, y1 = 1, lty = 2)
lines(x = res$x.val, y = res$y.val, type = "l", col = 2, lwd = 2, lty = 2)
lines(x = resBinormBoot$x.val, y = resBinormBoot$y.val, type = "l",
      col = 4, lwd = 2, lty = 2)


felix-hof/biostatUZH documentation built on Sept. 27, 2024, 1:48 p.m.