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’).
# S3 method for 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 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), ...)A plot of the building procedure of the ROC curve with the selected graphical parameters
An ROC curve object from movieROC package. Possible classes are: ‘groc’ (output of gROC() function) and ‘multiroc’ (output of multiROC() function).
False-positive rate for which the left plot is computed. Default: 0.15.
Marker cutoff for which the left plot is computed. Only available for a ‘groc’ object.
Marker cutoffs for which the left plot is computed. Only available for object of class ‘groc’ with side = "both" or "both2".
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).
If TRUE, histograms are displayed on the left instead of kernel density estimates. Default: FALSE. Only available for a ‘groc’ object.
If histogram = TRUE, number of breaks used for the histograms. Default: 15.
If FALSE, two extra graphics are displayed at the bottom (see Details for more information). Default: TRUE. Only available for a ‘groc’ object.
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.
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.
If TRUE, graphics are displayed in a new window. Default: FALSE. new not available for object of class ‘groc’.
If TRUE, a legend with colors meaning is displayed on the left graphic and the AUC is shown on the right graphic. Default: FALSE.
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".
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.
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).
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.
Range for x- and y-axis on the left plot. Only available for a ‘groc’ object.
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.
Label for x- and y-axis on the left plot. ylab not available for object of class ‘groc’.
Title for the left plot. Only available for a ‘groc’ object.
Vector of length 2 with the color used to control and case group, respectively. Default: c('#485C99','#8F3D52').
Color for the chosen point. Default: "FCBA04".
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.
Epsilon value to consider. Default: sqrt(.Machine$double.eps).
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’.
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’.
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’.
Epsilon value for steps. Not used. Not available for object of class ‘groc’.
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’.
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.
If method = "kernelOptimal" in a ‘multiroc’ object, the na.locf() function in the zoo package is used.
- 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.
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)
Run the code above in your browser using DataLab