movieROC {movieROC}R Documentation

Create a video with the building procedure of the ROC curve

Description

Save a video as a GIF illustrating the construction of the ROC curve. Particularly, for each element in vector fpr (optional input parameter), the function executed is

- for ‘groc’ objects:

plot_buildROC(obj, FPR = fpr[i], build.process = TRUE,...);

- for ‘multiroc’ objects:

plot_buildROC(obj, FPR = fpr[i], build.process = TRUE, display.method, displayOV,...)

Usage

movieROC(x, ...)
## S3 method for class 'groc'
movieROC(x, fpr = NULL, h = c(1,1), histogram = FALSE, breaks = 15,
  reduce = TRUE, completeROC = FALSE, videobar = TRUE, file = "animation1.gif",
  save = TRUE, legends = FALSE, speedcorrection = FALSE, tpause = 1, interval = 0.2,
  ani.width, ani.height, xlab = "Marker", main.density = "Density functions",
  cex.lab = 2.5, cex.axis = 1.75, cex.main = 2.25 + as.numeric(reduce),
  xlim = NULL, ylim = NULL, cex.point = 1.5, lwd.curve = 2, mar = NULL,
  lim.density = 0.01, col.controlscases = c("#485C99", "#8F3D52"),
  col.curve = "black", col.threshold = "#FCBA04", verbose = FALSE, ...)
## S3 method for class 'multiroc'
movieROC(x, fpr = NULL, display.method = c("PCA", "OV"),
  displayOV = c(1,2), border = TRUE, completeROC = FALSE, videobar = TRUE,
  file = "animation1.gif", save = TRUE, legends = FALSE, tpause = 1,
  interval = 0.2, ani.width, ani.height, xlab = NULL, ylab = NULL,
  cex = 0.8, cex.lab = 1.5, cex.axis = 1.5, cex.main = 2, alpha.points = 1,
  alpha.contour = 0.25, lwd.curve = 2, lty.curve = 1, lf = NULL,
  col.controlscases = c('#485C99','#8F3D52'), col.curve = 'black',
  col.threshold = '#FCBA04', verbose = FALSE, ...)

Arguments

x

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

fpr

A vector of false-positive rates for which the building process of the ROC curve is displayed. Default: if length of x$t is lower than 150, such vector is taken as fpr; otherwise, an equally-space vector of length 100 covering the range of the marker is considered.

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.

completeROC

A logical value indicating if the whole ROC curve should be displayed in light gray or not. Default: FALSE.

videobar

If TRUE, a text progress bar is shown in the R console. Default: TRUE.

verbose

If TRUE, a progress bar is displayed for computationally intensive methods. Default: FALSE.

file

File name of the movie (with the extension). Default: "animation1.gif".

save

If TRUE, video is saved as a GIF by using the saveGIF function in animation package. Default: TRUE.

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.

speedcorrection

If TRUE, only some FPR in fpr vector are considered to make the video faster. Default: FALSE. Only available for a ‘groc’ object.

tpause

If save = FALSE, time interval to suspend execution for, in seconds. Default: 1.

interval

If save = TRUE, a positive number to set the time interval of the animation (unit in seconds) in animation package. Default: 0.2.

ani.width, ani.height

If save = TRUE, width and height of image frames (unit in px) in animation package.

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.

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.

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. Only available for a ‘groc’ object.

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.

lty.curve, lwd.curve, col.curve

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

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.

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".

border

If TRUE, a border for the classification subsets is drawn. 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 = 1, alpha.contour = 0.25. Not available for object of class ‘groc’.

lf

Epsilon value for steps. Not used.

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 to the saveGIF() function in animation package.

Value

A video with the building procedure of the ROC curve estimate with the selected graphical parameters

Dependencies

If save = TRUE (by default), the saveGIF() function in the animation package is used.

Examples

data(HCC)

# Standard ROC curve for gene 20202438
roc_cg20202438 <- gROC(X = HCC$cg20202438, D = HCC$tumor, side = "right")

### The video will be saved as a GIF with the name "video_cg20202438"
movieROC(roc_cg20202438, file = "video_cg20202438.gif", save = 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")

# Two first components from PCA:
### The video will be saved as a GIF with the name "video_multiroc_pca"
movieROC(multiroc_PT, file = "video_multiroc_pca.gif", save = FALSE)


### The video will be saved as a GIF with the name "video_multiroc_orig"
movieROC(multiroc_PT, display.method = "OV", displayOV = c(1,3),
    file = "video_multiroc_orig.gif", cex = 1.2, xlab = "Gene 20202438",
    ylab = "Gene 03515901", lwd.curve = 4, save = FALSE)
  

[Package movieROC version 0.1.1 Index]