Learn R Programming

ROC632 (version 0.6)

ROC: Estimation of the traditional ROC curves (without censoring)

Description

This function performs estimations of ROC curves (without censoring) according to quantitative marker and a binary outcome.

Usage

ROC(status, marker, cut.values)

Arguments

status
A numeric vector with the indicators of the disease (e.g. 0=disease-free, 1=disease).
marker
A numeric vector with the values of the quantitative marker.
cut.values
The threshold values of the marker for which the coordinates of the ROC are computed.

Value

The function returns a list. cut.values is the vector of the input threshold values. TP and FP represent the corresponding false and true positive rates. AUC is the area under the curve.

Details

This function computes a traditional ROC curve (without right-censoring). The false positive and negative rates are obtained by estimating the corresponding proportion

Examples

Run this code

# import and attach the data example

X <- c(1, 2, 3, 4, 5, 6, 7, 8) # The value of the marker
Y <- c(0, 0, 0, 1, 0, 1, 1, 1) # The value of the binary outcome

ROC.obj <- ROC(status=Y, marker=X, cut.values=sort(X))
plot(ROC.obj$FP, ROC.obj$TP, ylab="True Positive Rates",
 xlab="False Positive Rates", type="s", lwd=2)

Run the code above in your browser using DataLab