**[R] roccomp** -- Tests of equality of ROC areas

__Syntax__

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*]

*roccomp_options* Description
-------------------------------------------------------------------------
Main
**by(***varname***)** split into groups by variable
**test(***matname***)** use contrast matrix for comparing ROC areas
__g__**raph** graph the ROC curve
__noref__**line** suppress plotting the 45-degree reference line
__sep__**arate** place each ROC curve on its own graph
__sum__**mary** report the area under the ROC curve
__bin__**ormal** estimate areas by using binormal distribution
assumption
__line____#__**opts(***cline_options***)** affect rendition of the *#*th binormal fit line
__l__**evel(***#***)** set confidence level; default is **level(95)**

Plot
__plot____#__**opts(***plot_options***)** affect rendition of the *#*th ROC curve

Reference line
__rlop__**ts(***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-3]** *twoway_options*
-------------------------------------------------------------------------

*rocgold_options* Description
-------------------------------------------------------------------------
Main
__sid__**ak** adjust the p-value by using Sidak's method
**test(***matname***)** use contrast matrix for comparing ROC areas
__g__**raph** graph the ROC curve
__noref__**line** suppress plotting the 45-degree reference line
__sep__**arate** place each ROC curve on its own graph
__sum__**mary** report the area under the ROC curve
__bin__**ormal** estimate areas by using binormal distribution
assumption
__line____#__**opts(***cline_options***)** affect rendition of the *#*th binormal fit line
__l__**evel(***#***)** set confidence level; default is **level(95)**

Plot
__plot____#__**opts(***plot_options***)** affect rendition of the *#*th ROC curve; plot 1
is the "gold standard"

Reference line
__rlop__**ts(***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-3]** *twoway_options*
-------------------------------------------------------------------------

*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
-------------------------------------------------------------------------

**fweight**s are allowed; see weight.

__Menu__

__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__

**roccomp** and **rocgold** 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.

**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 p-value. Optionally, Sidak's adjustment for multiple
comparisons can be obtained.

See **[R] rocfit** and **[R] rocreg** for commands that fit maximum-likelihood
ROC models.

__Options__

+------+
----+ 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 p-value be adjusted for the effect
of multiple comparisons by 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 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 needed only 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***)** affect the rendition of the line representing
the *#*th ROC curve drawn using the binormal distribution assumption;
see **[G-3]** *cline_options*. These lines are drawn only if 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**.

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

**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-3]**
*marker_options*, **[G-3]** *marker_label_options*, and **[G-3]** *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-3]** *cline_options*.

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

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

__Examples__

Setup
**. webuse ct2**

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**

__Stored results__

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

Scalars
**r(N_g)** number of groups
**r(p)** p-value for chi-squared test
**r(df)** chi-squared degrees of freedom
**r(chi2)** chi-squared

Matrices
**r(V)** variance-covariance matrix

**rocgold** stores 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)** vector of p-values for chi-squared tests
**r(p_adj)** vector of adjusted p-values