{smcl}
{* 20jun2001}{...}
{hline}
help for {hi:stcstat}{right:{net "from http://www.stata.com/users/wgould":http://www.stata.com/users/wgould}}
{hline}

{title:ROC curves after Cox regression}

{p 8 19}
{cmd:stcstat}
[{cmd:if} {it:exp}]
[{cmd:in} {it:range}]
[{cmd,}
    {cmd:all}
    {cmdab:nosh:ow}
]


{title:Description}

{p}
(The following is quoted from a posting that appeared on Statalist on
20jun2001)

{asis}

From:  wgould@stata.com (William Gould)
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: ROC with Cox Regression

In the thread started by Kathleen McGinnis <Kathleen.McGinnis2@med.va.gov>,

> I am interested in running ROC curves with Cox regression models. Does
> anyone know of a way to do this in STATA or is there an STB file that does
> this?

I provided an old Stata 5 -stcstat- program to make the calculation and I 
wrote, 

> Problem is, it is written for Stata 5 and the old -st- system.  That should
> not matter because Stata 7 will run old -st- programs without modification,
> but it sometimes requires the user simplify the -stset- beause the modern
> -st- has to make everything appear as if it were recorded in the old style.
> If that is required in Kathleen's problem, -st- will give the appropriate
> error messages and it ought to be clear what she needs to do.  Better,
> however, would be that the program were updated to use the modern -st-,
> which should be easy to do.

I have no updated the program to Stata 7 and, along the way, improved the 
syntax a little.  The syntax now is 

        stcstat [if <exp>] [in <range>] [, all noshow]
                                           --- ----

The improvement has to do with the -all- option.  By default, -stcstat-
restricts itself to the estimation subsample, so if you type 

        . stcox ... if <whatever>
        . stcstat 

you get C calculated on the estimation subsample.  If you type 

        . stcox ... if <whatever>
        . stcstat if <somethingelse>

The -if- on -stcstat- is applied to the estimation subsample, so you get 
a subsubsample.  If you want -stcstat- to run on all available data, 
specify the -all- option:

        . stcstat, all

and if you now specify an -if <exp>-, that restriction would be applied 
without also implying -if e(sample)-.

The other change I made was to change the output notation.  The output now 
looks like this:

        . stcstat

        Number of subjects:                 N =               74
        Number of comparisons:              D =              562
        Number of orderings as expected:    E =              303
        Number of tied predictions:         T =                3

                            C = (E + T/2) / D =          0.54181

That is, previously what now is N was called S and what now is E was called N.
I did that because stcstat now saves in r() the results and most of us would 
expect that r(N) would be the number of observations used, not the number of 
orderings that were as expected:

        . ret list

        scalars:
                         r(T) =  3
                         r(E) =  303
                         r(D) =  562
                         r(N) =  74
                         r(C) =  .541814946619217

I have tested the program only a little, but I wouldn't send it if I thought 
there were problems.

-- Bill
wgould@stata.com
