plot_densities {movieROC}R Documentation

Plot density function estimates for controls and cases

Description

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.

Usage

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, ...)

Arguments

obj

An object of class ‘groc’.

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 instead of kernel density estimates. Default: FALSE.

breaks

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

col

A vector of length 2 with color used for controls and cases, respectively. Default: c("#485C99", "#8F3D52").

lwd

Line width for the density function or histogram. Default: 2.

xlim, ylim

Range for x- and y-axis.

xaxs, yaxs

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.

xlab, ylab

Label for x- and y-axis.

main

Title for the plot.

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.

legend

If TRUE, a legend with the meaning of colors is displayed on the left plot. Default: FALSE.

pos.legend, cex.legend

The position and magnification to be used for legend, relative to the current setting of cex. Default: pos.legend = "topright", cex.legend = 1.

eps

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

new

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.

Value

A plot of the kernel density function estimates for both populations with the selected graphical parameters

Examples

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)

[Package movieROC version 0.1.1 Index]