Re: st: Combining ROC curves in one graph

Kim Peters wrote:
> I have plotted three ROC curves using
>
> roctab x1 y1, graph name(rocgraph1) nodraw
> roctab x2 y2, graph name(rocgraph2) nodraw
> roctab x3 y3, graph name(rocgraph3) nodraw
>
> How can I combine these three roclines into one graph.
> || or (...) do not seem to work.
All the receiver operating characteristic (ROC) commands in Stata use a

single status variable, with one or more classification variables. You
can automatically draw ROC curves for different classifiers using the
same status variable. A new command, -rocreg- can be used to draw ROC
curves for different status variables in the same graph.

Kim can use the new command -rocreg- to draw the graph she desires.
Here is a short answer to Kim's question.
You can use -rocreg- to fit several models, create the new variables
containing the false-positive rate and ROC values, and then plot the ROC
curves using -twoway-.
Here is a more detailed answer to Kim's question.
Let's consider an example using the Hanley data, where an individual's
neurological disease status is classified on a single 5-scale rating.

In the code below, we load the data and create a fictional
disease-status variable, -ndisease-, which zeroes the true status
variable, -disease-, with probability 2/10.

Now we use -rocreg- to estimate a nonparametric ROC curve of -disease-
and classification variable -rating-. We use the -quietly- prefix to
suppress output, and the -nobootstrap- option to prevent the bootstrap
calculation of standard errors because we are only interested in the
estimates of the false-positive rate and ROC value.

. quietly rocreg disease rating, nobootstrap

The ROC and false-positive rate values are saved as variables
-_roc_rating- and -_fpr_rating-. We rename the -_roc_rating- and
-_fpr_rating- variables before fitting the next ROC model, because we
will need them for the graph.

Now we will draw the ROC curves with -rating- as a classifier for
-disease-, and with -rating- as a classifier for -ndisease-. -twoway
scatter- is used with the || overlay operator. Since we are using the
empirical estimate of the ROC curve, We use the -connect(J)- option
rather than a simple line connector.