summaryROC: Function to compute ROC curve and an asymptotic confidence...

Description Usage Arguments Value Note Author(s) References See Also Examples

Description

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

Usage

1
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. Part of the function was derived from code by Andrea Riebler.

References

The original reference for computation of confidence intervals 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: Oxford University Press.

See Also

Similar functionality is provided in the package ROCR. However, this latter package offers no computation of confidence intervals.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
set.seed(1977)
ns <- c(50, 40)
truth <- c(rep(0, ns[1]), rep(1, ns[2]))
estimates <- c(rnorm(ns[1]), rnorm(ns[2], mean = 0.5, sd = 1.5))
cases <- estimates[truth == 1]
controls <- estimates[truth == 0]
res <- summaryROC(cases, controls, conf.level = 0.95)

# display results
res
res$res.mat

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

biostatUZH documentation built on May 2, 2019, 6:06 p.m.