This function plots the kernel density function estimates for controls and cases from an object of class ‘groc’. It offers the possibility of plotting the histograms instead of the smooth estimates.
plot_densities(obj, h = c(1, 1), histogram = FALSE, breaks = 15,
col = c("#485C99", "#8F3D52"), lwd = 2, xlim = NULL, ylim = NULL,
xaxs = "i", yaxs = "i", xlab = "Marker", ylab = "f(x)",
main = "Density functions", legend = FALSE, pos.legend = "topright",
cex.lab = 1.5, cex.axis = 1.5, cex.main = 2, cex.legend = 1,
eps = sqrt(.Machine$double.eps), new = TRUE, ...)A plot of the kernel density function estimates for both populations with the selected graphical parameters
An object of class ‘groc’.
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 instead of kernel density estimates. Default: FALSE.
If histogram = TRUE, number of breaks used for the histograms. Default: 15.
A vector of length 2 with color used for controls and cases, respectively. Default: c("#485C99", "#8F3D52").
Line width for the density function or histogram. Default: 2.
Range for x- and y-axis.
The style of axis interval calculation to be used for the x- and the y-axis, respectively. Default: "i" (internal; just finds an axis with pretty labels that fits within the original data range). For more information, see help for par.
Label for x- and y-axis.
Title for the plot.
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.
If TRUE, a legend with the meaning of colors is displayed on the left plot. Default: FALSE.
The position and magnification to be used for legend, relative to the current setting of cex. Default: pos.legend = "topright", cex.legend = 1.
Epsilon value to consider. Default: sqrt(.Machine$double.eps).
If TRUE, a new plot is displayed; otherwise, density estimates are displayed over the current plot. Default: TRUE.
Other parameters to be passed. Not used.
data(HCC)
roc_cg20202438 <- gROC(X = HCC$cg20202438, D = HCC$tumor)
plot_densities(roc_cg20202438, main = "Density functions and histogram")
plot_densities(roc_cg20202438, histogram = TRUE, new = FALSE)
Run the code above in your browser using DataLab