**[R] roctab** -- Nonparametric ROC analysis

__Syntax__

**roctab** *refvar* *classvar* [*if*] [*in*] [*weight*] [**,** *options*]

*options* Description
-------------------------------------------------------------------------
Main
__lor__**enz** report Gini and Pietra indices
__bino__**mial** calculate exact binomial confidence intervals
__nolab__**el** display numeric codes rather than value labels
__d__**etail** show details on sensitivity/specificity for
each cutpoint
__tab__**le** display the raw data in a 2 x k contingency
table
__bam__**ber** calculate standard errors by using the Bamber
method
__han__**ley** calculate standard errors by using the Hanley
method
__g__**raph** graph the ROC curve
__noref__**line** suppress plotting the 45-degree reference line
__sum__**mary** report the area under the ROC curve
__spec__**ificity** graph sensitivity versus specificity
__l__**evel(***#***)** set confidence level; default is **level(95)**

Plot
__plotop__**ts(***plot_options***)** affect rendition of the ROC curve

Reference line
__rlop__**ts(***cline_options***)** affect rendition of the reference line

Add plots
**addplot(***plot***)** add other plots to generated graph

Y axis, X axis, Titles, Legend, Overall
*twoway_options* any options other than **by()** documented in
**[G-3]** *twoway_options*
-------------------------------------------------------------------------
**fweight**s are allowed; see weight.

*plot_options* Description
-------------------------------------------------------------------------
*marker_options* change look of markers (color, size, etc.)
*marker_label_options* add marker labels; change look or position
*cline_options* change look of the line
-------------------------------------------------------------------------

__Menu__

**Statistics > Epidemiology and related > ROC analysis >** **Nonparametric ROC**
**analysis without covariates**

__Description__

The above command is used to perform receiver operating characteristic
(ROC) analyses with rating and discrete classification data.

The two variables *refvar* and *classvar* must be numeric. The reference
variable indicates the true state of the observation, such as diseased
and nondiseased or normal and abnormal, and must be coded as 0 and 1.
The rating or outcome of the diagnostic test or test modality is recorded
in *classvar*, which must be at least ordinal, with higher values
indicating higher risk.

**roctab** performs nonparametric ROC analyses. By default, **roctab**
calculates the area under the ROC curve. Optionally, **roctab** can plot the
ROC curve, display the data in tabular form, and produce Lorenz-like
plots.

See **[R] rocfit** for a command that fits maximum-likelihood ROC models.

__Options__

+------+
----+ Main +-------------------------------------------------------------

**lorenz** specifies that the Gini and Pietra indices be reported.
Optionally, **graph** will plot the Lorenz-like curve.

**binomial** specifies that exact binomial confidence intervals be
calculated.

**nolabel** specifies that numeric codes be displayed rather than value
labels.

**detail** outputs a table displaying the sensitivity, specificity, the
percentage of subjects correctly classified, and two likelihood
ratios for each possible cutpoint of *classvar*.

**table** outputs a 2 x k contingency table displaying the raw data.

**bamber** specifies that the standard error for the area under the ROC curve
be calculated using the method suggested by Bamber (1975).
Otherwise, standard errors are obtained as suggested by DeLong,
DeLong, and Clarke-Pearson (1988).

**hanley** specifies that the standard error for the area under the ROC curve
be calculated using the method suggested by Hanley and McNeil (1982).
Otherwise, standard errors are obtained as suggested by DeLong,
DeLong, and Clarke-Pearson (1988).

**graph** produces graphical output of the ROC curve. If **lorenz** is specified,
the graphical output of a Lorenz-like curve will be produced.

**norefline** suppresses plotting the 45-degree reference line from the
graphical output of the ROC curve.

**summary** reports the area under the ROC curve, its standard error, and its
confidence interval. If **lorenz** is specified, Lorenz indices are
reported. This option is needed only when also specifying **graph**.

**specificity** produces a graph of sensitivity versus specificity instead of
sensitivity versus (1 - specificity). **specificity** implies **graph**.

**level(***#***)** specifies the confidence level, as a percentage, for the
confidence intervals. The default is **level(95)** or as set by **set**
**level**.

+------+
----+ Plot +-------------------------------------------------------------

**plotopts(***plot_options***)** affects the rendition of the plotted ROC curve --
the curve's plotted points connected by lines. The *plot_options* can
affect the size and color of markers, whether and how the markers are
labeled, and whether and how the points are connected; see **[G-3]**
*marker_options*, **[G-3]** *marker_label_options*, and **[G-3]** *cline_options*.

+----------------+
----+ Reference line +---------------------------------------------------

**rlopts(***cline_options***)** affects the rendition of the reference line; see
**[G-3]** *cline_options*.

+-----------+
----+ Add plots +--------------------------------------------------------

**addplot(***plot***)** provides a way to add other plots to the generated graph;
see **[G-3]** *addplot_option*.

+-----------------------------------------+
----+ Y axis, X axis, Titles, Legend, Overall +--------------------------

*twoway_options* are any of the options documented in **[G-3]** *twoway_options*,
excluding **by()**. These include options for titling the graph (see
**[G-3]** *title_options*) and for saving the graph to disk (see **[G-3]**
*saving_option*).

__Examples__

Nonparametric ROC analysis example
**. webuse hanley**
**. roctab disease rating**
**. roctab disease rating, graph**
**. roctab disease rating, graph summary**
**. roctab disease rating [fw=pop]**
**. roctab disease rating, table detail**
**. roctab disease rating, lorenz**
**. roctab disease rating, lorenz graph**

__Stored results__

**roctab** stores the following in **r()**:

Scalars
**r(N)** number of observations
**r(se)** standard error for the area under the ROC curve
**r(lb)** lower bound of CI for the area under the ROC curve
**r(ub)** upper bound of CI for the area under the ROC curve
**r(level)** confidence level
**r(area)** area under the ROC curve
**r(pietra)** Pietra index
**r(gini)** Gini index

Macros
**r(cutpoints)** description of cutpoints (**detail** only)

Matrices
**r(detail)** matrix with details on sensitivity and specificity for
each cutpoint (**detail** only)

__References__

Bamber, D. 1975. The area above the ordinal dominance graph and the area
below the receiver operating characteristic graph. *Journal of*
*Mathematical Psychology* 12: 387-415.

DeLong, E. R., D. M. DeLong, and D. L. Clarke-Pearson. 1988. Comparing
the areas under two or more correlated receiver operating
characteristic curves: A nonparametric approach. *Biometrics* 44:
837-845.

Hanley, J. A., and B. J. McNeil. 1982. The meaning and use of the area
under a receiver operating characteristic (ROC) curve. *Radiology* 143:
29-36.