help roctab, help roccomp, help rocgold dialogs: roctab roccomp
rocgold
-------------------------------------------------------------------------------
Title
[R] roc -- Receiver operating characteristic (ROC) analysis
Syntax
Perform nonparametric ROC analysis
roctab refvar classvar [if] [in] [weight] [, roctab_options]
Test equality of ROC areas
roccomp refvar classvar [classvars] [if] [in] [weight] [,
roccomp_options]
Test equality of ROC area against a standard ROC curve
rocgold refvar goldvar classvar [classvars] [if] [in] [weight] [,
rocgold_options]
roctab_options description
-------------------------------------------------------------------------
Main
lorenz report Gini and Pietra indices
binomial calculate exact binomial confidence intervals
detail show details on sensitivity/specificity for
each cutpoint
table display the raw data in a 2 x k contingency
table
bamber calculate standard errors by using the Bamber
method
hanley calculate standard errors by using the Hanley
method
graph graph the ROC curve
norefline suppress plotting of the 45-degree reference
line
summary report the area under the ROC curve
specificity graph sensitivity versus specificity
level(#) set confidence level; default is level(95)
Plot
plotopts(plot_options) affect rendition of the ROC curve
Reference line
rlopts(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] twoway_options
-------------------------------------------------------------------------
fweights are allowed; see weight.
roccomp_options description
-------------------------------------------------------------------------
Main
by(varname) split into groups by variable
test(matname) use contrast matrix for comparing ROC areas
graph graph the ROC curve
norefline suppress plotting of the 45-degree reference
line
separate place each ROC curve on its own graph
summary report the area under the ROC curve
binormal estimate areas by using binormal distribution
assumption
line#opts(cline_options) affect rendition of the #th binormal fit line
level(#) set confidence level; default is level(95)
Plots
plot#opts(plot_options) affect rendition of the #th ROC curve
Reference line
rlopts(cline_options) affect rendition of the reference line
Y axis, X axis, Titles, Legend, Overall
twoway_options any options other than by documented in
[G] twoway_options
-------------------------------------------------------------------------
fweights are allowed; see weight.
rocgold_options description
-------------------------------------------------------------------------
Main
sidak adjust the significance probability by using
Sidak's method
test(matname) use contrast matrix for comparing ROC areas
graph graph the ROC curve
norefline suppress plotting of the 45-degree reference
line
separate place each ROC curve on its own graph
summary report the area under the ROC curve
binormal estimate areas by using binormal distribution
assumption
line#opts(cline_options) affect rendition of the #th binormal fit line
level(#) set confidence level; default is level(95)
Plots
plot#opts(plot_options) affect rendition of the #th ROC curve; plot 1
is the "gold standard"
Reference line
rlopts(cline_options) affect rendition of the reference line
Y axis, X axis, Titles, Legend, Overall
twoway_options any options other than by documented in
[G] twoway_options
-------------------------------------------------------------------------
fweights 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 the look of the line
-------------------------------------------------------------------------
Menu
roctab
Statistics > Epidemiology and related > ROC analysis > Nonparametric
ROC analysis
roccomp
Statistics > Epidemiology and related > ROC analysis > Test equality
of two or more ROC areas
rocgold
Statistics > Epidemiology and related > ROC analysis > Test equality
of ROC area against gold standard
Description
The above commands are 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.
roccomp tests the equality of two or more ROC areas obtained from
applying two or more test modalities to the same sample or to independent
samples. roccomp expects the data to be in wide form when comparing
areas estimated from the same sample and in long form for areas estimated
from independent samples.
rocgold independently tests the equality of the ROC area of each of
several test modalities, specified by casevar, against a "gold standard"
ROC curve, goldvar. For each comparison, rocgold reports the raw and the
Bonferroni-adjusted significance probability. Optionally, Sidak's
adjustment for multiple comparisons can be obtained.
See [R] rocfit for a command that fits maximum-likelihood ROC models.
Options for roctab
+------+
----+ 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.
detail outputs a table displaying the sensitivity, specificity, the
percent 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 graphic output of a Lorenz-like curve will be produced.
norefline suppresses the plotting of 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 ROC curve -- the
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] marker_options,
> [G] marker_label_options, and [G] cline_options.
+----------------+
----+ Reference line +---------------------------------------------------
rlopts(cline_options) affects the rendition of the reference line; see
[G] cline_options.
+-----------+
----+ Add plots +--------------------------------------------------------
addplot(plot) provides a way to add other plots to the generated graph;
see [G] addplot_option.
+-----------------------------------------+
----+ Y axis, X axis, Titles, Legend, Overall +--------------------------
twoway_options are any of the options documented in [G] twoway_options,
excluding by(). These include options for titling the graph (see [G]
title_options) and for saving the graph to disk (see [G]
saving_option).
Options for roccomp and rocgold
+------+
----+ Main +-------------------------------------------------------------
by(varname) (roccomp only) is required when comparing independent ROC
areas. The by() variable identifies the groups to be compared.
sidak (rocgold only) requests that the significance probability be
adjusted for the effect of multiple comparisons using Sidak's method.
Bonferroni's adjustment is reported by default.
test(matname) specifies the contrast matrix to be used when comparing ROC
areas. By default, the null hypothesis that all areas are equal is
tested.
graph produces graphical output of the ROC curve.
norefline suppresses plotting of the 45-degree reference line from the
graphical output of the ROC curve.
separate is meaningful only with roccomp and specifies that each ROC
curve be placed on its own graph rather than one curve on top of the
other.
summary reports the area under the ROC curve, its standard error, and its
confidence interval. This option is only needed when also specifying
graph.
binormal specifies that the areas under the ROC curves to be compared
should be estimated using the binormal distribution assumption. By
default, areas to be compared are computed using the trapezoidal
rule.
line#opts(cline_options) affects rendition of line representing the #th
ROC curve drawn using the binormal distribution assumption; see [G]
cline_options. These lines are drawn only when the binormal option
is specified.
level(#) specifies the confidence level, as a percentage, for the
confidence intervals. The default is level(95) or as set by set
level.
+-------+
----+ Plots +------------------------------------------------------------
plot#opts(plot_options) affect the rendition of the #th 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]
marker_options, [G] marker_label_options, and [G] cline_options.
For rocgold, plot1opts() are applied to the ROC for the gold
standard.
+----------------+
----+ Reference line +---------------------------------------------------
rlopts(cline_options) affects the rendition of the reference line; see
[G] cline_options.
+-----------------------------------------+
----+ Y axis, X axis, Titles, Legend, Overall +--------------------------
twoway_options are any of the options documented in [G] twoway_options.
These include options for titling the graph (see [G] title_options),
options for saving the graph to disk (see [G] saving_option), and the
by() option (see [G] by_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
---------------------------------------------------------------------------
Setup
. webuse ct2, clear
Test whether area under ROC for mod1 equals area under ROC for mod3
. roccomp status mod1 mod3
Add graph of ROC curves
. roccomp status mod1 mod3, graph summary
Use contrast matrix C when comparing ROC areas
. matrix C = (1,0,-1)
. roccomp status mod1 mod2 mod3, test(C)
Compare mod2 and mod3 areas to the mod1 gold standard
. rocgold status mod1 mod2 mod3
Add graph of ROC curves
. rocgold status mod1 mod2 mod3, graph summary
---------------------------------------------------------------------------
Saved results
roctab saves 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(area) area under the ROC curve
r(pietra) Pietra index
r(gini) Gini index
roccomp saves the following in r():
Scalars
r(N_g) number of groups
r(p) significance probability
r(df) chi-squared degrees of freedom
r(chi2) chi-squared
Matrices
r(V) variance-covariance matrix
rocgold saves the following in r():
Scalars
r(N_g) number of groups
Matrices
r(V) variance-covariance matrix
r(chi2) chi-squared vector
r(df) chi-squared degrees-of-freedom vector
r(p) significance-probability vector
r(p_adj) adjusted significance-probability vector
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.
Also see
Manual: [R] roc
Help: [R] logistic, [R] rocfit