ROC: ROC curves

Description Usage Arguments Value Author(s) References Examples

View source: R/roc.R

Description

Functions for making, plotting and analysing ROC curves.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
ROC(TestResult, ...)
## Default S3 method:
ROC(TestResult, D, take.abs = TRUE, ...)
## S3 method for class 'ROC'
plot(x, type = "b", null.line = TRUE,
xlab = "False Pos. Rate", ylab = "True Pos. Rate",
xlim = c(0, 1), ylim = c(0, 1), main = "ROC", ...) 
## S3 method for class 'ROC'
points(x, ...)
## S3 method for class 'ROC'
lines(x, ...)
## S3 method for class 'ROC'
identify(x, labels = NULL, ..., digits = 1)
## S3 method for class 'ROC'
print(x, ...)
roc.value(found, true, totalN)
AUC(x, max.mspec)

Arguments

TestResult

Typically regression coefficients or t statistics. Note that when p values are used directly, the least significant values would be selected first. In this case one should use 1/p.

D

True, known, differences, either expressed as a vector of 0 and 1 of the same length as TestResult or as a vector of indices.

take.abs

Logical, indicating whether to take absolute values of the test statistic.

x

An object of class ROC.

type, xlab, ylab, xlim, ylim, main, labels, digits

Standard arguments to functions like plot and identify.

null.line

Logical, whether to draw the line y = x, corresponding to random guessing.

max.mspec

Maximal value of the True Positive Rate to consider in AUC calculations. Setting this to a value smaller than one (which is the default) leads to a partial AUC value, which may in many cases be more useful.

found

The indices of the coefficients identified with a biomarker identification method.

true

The indices of the true biomarkers.

totalN

The total number of variables to choose from.

...

Further arguments, especially useful in the plotting functions.

Value

Function ROC returns a list with elements:

  1. sensSensitivity, or True Positive Rate (TPR).

  2. mspec1 - Specificity, or False Positive Rate (FPR).

  3. testlevels of the test statistic.

  4. callFunction call.

Function roc.value returns a list with elements sens and mspec, i.e., one point on a ROC curve.

Function AUC returns the area under the curve, measured up to the value of max.mspec - if the latter is smaller than 1, it is a partial AUC curve.

Author(s)

Ron Wehrens

References

T. Lumley: ROC curves - in Programme's Niche, R News 4/1, June 2004.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
data(spikedApples)
apple.coef <- get.biom(X = spikedApples$dataMatrix,
                       Y = rep(1:2, each = 10),
                       fmethod = "vip",
                       ncomp = 3, type = "coef")

## ROC curve for all VIP values, ordered according to size
true.biom <- (1:ncol(spikedApples$dataMatrix) %in% spikedApples$biom)
vip.roc <- ROC(apple.coef$vip, true.biom)
plot(vip.roc)

## Add stability-based selection point
apple.stab <- get.biom(X = spikedApples$dataMatrix,
                       Y = rep(1:2, each = 10),
                       fmethod = "vip",
                       ncomp = 3, type = "stab")
stab.roc <- roc.value(apple.stab$vip[[1]]$biom.indices,
                      spikedApples$biom,
                      totalN = ncol(spikedApples$dataMatrix))
points(stab.roc, col = "red", pch = 19, cex = 1.5)

## Not run: 
## Add HC-based selection point
## Attention: takes approx. 2 minutes on my PC
apple.HC <- get.biom(X = spikedApples$dataMatrix,
                     Y = rep(1:2, each = 10),
                     fmethod = "vip",
                     ncomp = 3, type = "HC")
HC.roc <- roc.value(apple.HC$vip$biom.indices,
                    spikedApples$biom,
                    totalN = ncol(spikedApples$dataMatrix))
points(HC.roc, col = "blue", pch = 19, cex = 1.5)

## End(Not run)

BioMark documentation built on May 2, 2019, 3:01 a.m.

Related to ROC in BioMark...