plot_buildROC {movieROC}R Documentation

Plot the building procedure of the ROC curve

Description

This function tracks the ROC curve. It plots two graphics in the same figure: right, the empirical ROC curve estimate; left, classification subset for a particular FPR or threshold(s) for the marker (threshold only for object of class ‘groc’).

Usage

## S3 method for class 'groc'
plot_buildROC(x, FPR = NULL, C = NULL, XL = NULL, XU = NULL, h = c(1,1), 
    histogram = FALSE, breaks = 15, reduce = TRUE, build.process = FALSE, 
    completeROC = FALSE, new.window = FALSE, legends = FALSE, type = 's', 
    cex.point = 1.5, lwd.curve = 2, mar = NULL, lim.density = 0.01, xlim = NULL, 
    ylim = NULL, cex.lab = 1.5, cex.axis = 1.5, cex.main = 2, xlab = "Marker", 
    main.density = "Density functions", col.controlscases = c('#485C99','#8F3D52'), 
    col.threshold = '#FCBA04', col.curve = 'black', eps = sqrt(.Machine$double.eps), 
    ...)
## S3 method for class 'multiroc'
plot_buildROC(x, FPR = 0.15, display.method = c("PCA", "OV"), 
    displayOV = c(1,2), build.process = FALSE, completeROC = TRUE, 
    new = FALSE, new.window = FALSE, border = FALSE, cutoff = TRUE, legends = FALSE, 
    type = 's', col.controlscases = c('#485C99','#8F3D52'), 
    col.threshold = '#FCBA04', col.curve = 'black', cex.point = 1.5, 
    alpha.points = .75, alpha.contour = 0.25, lwd.curve = 2, lty.curve = 1, 
    cex = 0.8, cex.lab = 1.5, cex.axis = 1.5, cex.main = 2, xlab = NULL, ylab = NULL, 
    lf = NULL, eps = sqrt(.Machine$double.eps), ...)

Arguments

x

An ROC curve object from movieROC package. Possible classes are: ‘groc’ (output of gROC() function) and ‘multiroc’ (output of multiROC() function).

FPR

False-positive rate for which the left plot is computed. Default: 0.15.

C

Marker cutoff for which the left plot is computed. Only available for a ‘groc’ object.

XL, XU

Marker cutoffs for which the left plot is computed. Only available for object of class ‘groc’ with side = "both" or "both2".

h

A vector of length 2 with the bandwidth used to compute kernel density estimation for controls and cases, respectively. See adjust parameter in density() function from stats package. Default: h = c(1,1).

histogram

If TRUE, histograms are displayed on the left instead of kernel density estimates. Default: FALSE. Only available for a ‘groc’ object.

breaks

If histogram = TRUE, number of breaks used for the histograms. Default: 15.

reduce

If FALSE, two extra graphics are displayed at the bottom (see Details for more information). Default: TRUE. Only available for a ‘groc’ object.

build.process

If FALSE, the whole ROC curve is displayed; otherwise, if completeROC = TRUE, the portion of the ROC curve until the fixed FPR is highlighted in black and the rest is shown in gray. Default: FALSE.

completeROC

If build.process = TRUE, a logical value indicating if the whole ROC curve should be displayed in light gray or not. Default: FALSE for ‘groc’ object; TRUE for ‘multiroc’ object.

new.window, new

If TRUE, graphics are displayed in a new window. Default: FALSE. new not available for object of class ‘groc’.

legends

If TRUE, a legend with colors meaning is displayed on the left graphic and the AUC is shown on the right graphic. Default: FALSE.

type, lty.curve, lwd.curve, col.curve

The line type, width and color for ROC curve. Default: type = "s" (stair steps), lty.curve = 1 (solid), lwd.curve = 2 and col.curve = "black".

cex.lab, cex.axis, cex.main

The magnification to be used for labels, axis annotation and main titles, respectively, relative to the current setting of cex. Default: cex.lab = 1.5, cex.axis = 1.5, cex.main = 2.

cex

A numerical value giving the amount by which plotting text and symbols should be magnified relative to the default. Default: 0.8. Not available for object of class ‘groc’ (cex=1 in this case).

cex.point

The magnification to be used for the particular point on the ROC curve and its text, relative to the current setting of cex. Default: cex.point = 1.5.

xlim, ylim

Range for x- and y-axis on the left plot. Only available for a ‘groc’ object.

lim.density

If xlim is NULL, lower limit for the density estimate to compute the range for the x-axis on the left plot. Default: 0.01. Only available for a ‘groc’ object.

xlab, ylab

Label for x- and y-axis on the left plot. ylab not available for object of class ‘groc’.

main.density

Title for the left plot. Only available for a ‘groc’ object.

col.controlscases

Vector of length 2 with the color used to control and case group, respectively. Default: c('#485C99','#8F3D52').

col.threshold

Color for the chosen point. Default: "FCBA04".

mar

A numerical vector of the form c(bottom, left, top, right) which gives the number of lines of margin to be specified on the four sides of the plot. Only available for a ‘groc’ object.

eps

Epsilon value to consider. Default: sqrt(.Machine$double.eps).

border

If TRUE, a border for the classification subsets is drawn. Default: FALSE for ‘multiroc’ object (TRUE if p=2). Not available for object of class ‘groc’.

cutoff

If TRUE, the cutoff value for the resulting univariate marker is displayed on the right plot (ROC curve). Default: TRUE. Not available for object of class ‘groc’.

alpha.points, alpha.contour

Number in [0,1] modifying the opacity alpha of the color for the points and classification region. The adjustcolor() function in grDevices package is used. Default: alpha.points = 0.75, alpha.contour = 0.25. Not available for object of class ‘groc’.

lf

Epsilon value for steps. Not used. Not available for object of class ‘groc’.

display.method

Method to display the marker values from a ‘multiroc’ object on the left plot. Methods available: "OV" (projected over two selected components of the marker indicated in displayOV), or "PCA" (projected over the two principal components from a Principal Component Analysis). Default: "PCA". Only available for object of class ‘multiroc’.

displayOV

If display.method = "OV", the two components of the marker used to project the marker values on the left plot. Default: c(1,2) (two first components). Only available for object of class ‘multiroc’.

...

Other parameters to be passed. Not used.

Details

- For univariate ROC curves:

It plots two graphics in the same figure: left, density function estimates for the marker in both populations with the areas corresponding to FPR and TPR colored (blue and red, respectively) for a particular FPR or threshold(s) for the marker; right, the empirical ROC curve estimate.

For an object of class ‘groc’, if the input parameter reduce = FALSE, two more graphics are displayed at the bottom: left, boxplots for the marker distribution in both populations; right, classification subsets for every false-positive rate (grey color by default).

- For multivariate ROC curves:

Plot two graphics in the same figure: right, the ROC curve highlighting the point and the threshold for the resulting univariate marker; left, scatterplot with the marker values for controls (blue color) and cases (red color), and the classification subset (in gold color) reporting the false-positive rate selected by the user (if FPR is not NULL).

If build.process = FALSE, the whole ROC curve is displayed; otherwise, if completeROC = TRUE, the portion of the ROC curve until the fixed FPR is highlighted in black and the rest is shown in gray, while if completeROC = FALSE, only the first portion of the curve is illustrated.

Value

A plot of the building procedure of the ROC curve with the selected graphical parameters

Dependencies

If method = "kernelOptimal" in a ‘multiroc’ object, the na.locf() function in the zoo package is used.

Examples

data(HCC)

# Standard ROC curve for gene 20202438
roc_cg20202438 <- gROC(X = HCC$cg20202438, D = HCC$tumor, side = "right")
plot_buildROC(roc_cg20202438)
plot_buildROC(roc_cg20202438, C = .77, build.process = TRUE, reduce = FALSE)

# Multivariate ROC curve for genes 0202438, 18384097, and 03515901
multiroc_PT <- multiROC(X = cbind(HCC$cg20202438, HCC$cg18384097, HCC$cg03515901), 
    D = HCC$tumor, method = "fixedLinear", methodLinear = "PepeThompson")
plot_buildROC(multiroc_PT, cex = 1.2, lwd.curve = 4) # Two first components from PCA
plot_buildROC(multiroc_PT, display.method = "OV", displayOV = c(1,3), 
    cex = 1.2, xlab = "Gene 20202438", ylab = "Gene 03515901", lwd.curve = 4)

[Package movieROC version 0.1.1 Index]