TeachingDemos (version 2.12)

roc.demo: Demonstrate ROC curves by interactively building one

Description

This demonstration allows you to interactively build a Receiver Operator Curve to better understand what goes into creating them.

Usage

roc.demo(x = rnorm(25, 10, 1), y = rnorm(25, 11, 1.5))

Value

No meaninful value is returned, this function is run solely for the side effects.

Arguments

x

Data values for group 1 (controls).

y

Data values for group 2 (cases).

Author

Greg Snow 538280@gmail.com

Details

Density plots for the 2 groups will be created in the lower panel of the plot (colored red (group 1) and blue (group 2)) along with rug plots of the actual datapoints. There is also a green vertical line that represents a decision rule cutoff, any points higher than the cutoff are predicted to be in group 2 and points less than the cuttoff are predicted to be in group 1. The sensitivity and specificity for the current cuttoff value are printed below the plot.

A Tk slider box is also created that allows you to move the cuttoff value and update the plots. As the cutoff value changes, the different combinations of sensitivity and specificity are added to the ROC curve in the top panel (the point corresponding to the current cuttoff value is highlighted in red). A line is also drawn from the point representing sensitivity and specificity both equal to 1 to the point closest to it.

See Also

slider, ROC function in package Epi, auROC in package limma, package ROC

Examples

Run this code

if(interactive()){
roc.demo()
with(CO2,
  roc.demo(uptake[Type=='Mississippi'],
           uptake[Type=='Quebec']       )
)
}

Run the code above in your browser using DataCamp Workspace