clinfun (version 1.0.15)

roc.curve: Empirical ROC curve

Description

Computes the empricial ROC curve for a diagnostic tool.

Usage

roc.curve(marker, status, method=c("empirical"))
  # S3 method for roc.curve
print(x, …)
  # S3 method for roc.curve
plot(x, …)
  # S3 method for roc.curve
lines(x, …)

Arguments

marker

the marker values for each subject.

status

binary disease status indicator

method

the method for estimating the ROC curve. Currently only the empirical curve is implemented.

x

object of class roc.area.test output from this function.

...

optional arguments to the print, plot and lines functions.

Value

a list with the following elements

tpr

true positive rates for all thresholds.

fpr

true positive rates for all thresholds.

marker

the diagnostic marker being studied.

status

binary disease

The "print" method returns the nonparametric AUC and its s.e.

The "plot" and "lines" methods can be used to draw a new plot and add to an existing plot of ROC curve.

Details

The computation is based on assuming that larger values of the marker is indicative of the disease. So for a given threshold x0, TPR is P(marker >= x0|status =1) and FPR is P(marker >= x0|status =0). This function computes the empirical estimates of TPR and FPR.

Examples

Run this code
# NOT RUN {
g <- rep(0:1, 50)
x <- rnorm(100) + g
y <- rnorm(100) + 1.5*g
o <- roc.curve(x, g)
plot(o)
lines(roc.curve(y, g), col=2)
# }

Run the code above in your browser using DataLab