hROC {movieROC}R Documentation

Build a ROC curve for a transformation of a univariate marker

Description

This is one of the main functions of the movieROC package. It builds a univariate ROC curve for a transformed marker h(X) and returns a ‘hroc’ object, a list of class ‘hroc’. This object can be printed, plotted, or predicted for a particular point. It may be also passed to plot.funregions and plot.regions functions.

Usage

hROC(X, D, ...)
## Default S3 method:
hROC(X, D, type = c("lrm", "h.fun", "overfitting"), 
    formula.lrm = "D ~ pol(X,3)", h.fun = function(x) {x}, 
    plot.h = FALSE, plot.roc = FALSE, new.window = FALSE, 
    main = NULL, xlab = "x", ylab = "h(x)", xaxis = TRUE, ...)

Arguments

X

Vector of marker values.

D

Vector of response values. Two levels; if more, the two first ones are used.

type

Type of transformation considered. One of "lrm" (a binary logistic regression is computed by using lrm function in rms package), "h.fun" (the transformation indicated in the input parameter h.fun is considered) or "overfitting" (the overfitting transformation, \ell_{of}(\cdot) is taken). Default: "lrm".

formula.lrm

If type = "lrm", the transformation employed in the right-hand side of the logistic regression model (in terms of X and D). Default: 'D ~ pol(X, 3)'.

h.fun

If type = "h.fun", the transformation employed (as a function in R). Default: function(x){x}.

plot.h

If TRUE, the transformation employed is illustrated.

plot.roc

If TRUE, the resulting ROC curve is illustrated.

new.window

If TRUE, two previous graphics are plotted separately in different windows.

main

A main title for the plot used if plot.h = TRUE.

xlab, ylab

A label for the x and y axis of the plot used if plot.h = TRUE.

xaxis

Graphical parameter used if plot.h = TRUE. If FALSE, plotting of the axis is supressed.

...

Other parameters to be passed. Not used.

Value

A list of class ‘hroc’ with the following fields:

levels

Levels of response values.

X, Y

Original and transformed marker values, respectively.

Sp, Se

Vector of true-negtive and true-positive rates, respectively.

auc

Area under the curve estimate.

model

If type = "lrm", the coefficients of the logistic regression model fitted by formula.

Examples

data(HCC)

# ROC curve for gene 18384097 to identify tumor by considering 4  different transformations:
X <- HCC$cg18384097; D <- HCC$tumor
## 1. Ordinary cubic polynomial formula for binary logistic regression
hROC(X, D)
## 2. Linear tail-restricted cubic splines for binary logistic regression
hROC(X, D, formula.lrm = "D ~ rcs(X,8)")
## 3. Overfitting transformation for this particular sample
hROC(X, D, type = "overfitting")
## 4. Optimal transformation in terms of likelihood ratio 
##    by kernel density estimation with bandwidth h=3
EstDensTransf_FUN <- function(X, D, h = 1){
  D <- as.factor(D)
  controls <- X[D == levels(D)[1]]; dens_controls <- density(controls, adjust = h)
  cases <- X[D == levels(D)[2]]; dens_cases <- density(cases, adjust = h)
  dens_controls_FUN <- approxfun(dens_controls$x, dens_controls$y, rule = 0)
  dens_cases_FUN <- approxfun(dens_cases$x, dens_cases$y, rule = 0)
  function(x) dens_cases_FUN(x)/(dens_controls_FUN(x) + dens_cases_FUN(x))
}
hROC(X, D, type = "h.fun", h.fun = function(x) EstDensTransf_FUN(X, D, h = 3)(x))

[Package movieROC version 0.1.0 Index]