I think there is a fairly simple modification that will save the
requested information.
Martin Weiss said in response to Jacob Wegelin's question about saving
cutpoint information in -roctab-:
> Well,
>
> it is not hard to see that the values displayed in the table after -roctab,
> detail- are stored in -tempvar-s named "sens" "spec" "corr" "lrp" "lrn",
> with the cutpoints in the first column stored in a -local-. The returned
> values do not make them available, and the question is really: why not put
> them into a matrix and return it?
>
> The -tempvar-s die when -roctab- terminates, so you might want to make a
> copy of -roctab- and edit it to tell Stata to turn them into permanent
> objects. But as you correctly say: it is probably easier to program this
> yourself than to figure out a way to make the -tempvar-s permanent.
>
> HTH
> Martin
There are a couple of places in -roctab- that allow you return the
tempnames and a matrix of the tempvars.
If you want to modify it, here is the process:
Open roctab.ado and edit the second line to:
prog def roctab2, rclass sortpreserve
and save the program as roctab2.ado
Search for the line: qui replace `prob'=. if `sens'==1 & `spec'==0 & _n==1
and immediately afterward insert:
// Added code begin
return matrix cut = cut
forvalues i==1/`r(cuts)' {
return local cut_`i' `r(cut_`i')'
return local lrn_`i' `r(lrn_`i')'
return local lrp_`i' `r(lrp_`i')'
return local corr_`i' `r(corr_`i')'
}
// Added code end
Search for the line: */ _col(71) %8.4f `lrn'
and insert immediately afterward:
// Added code begin
return local cut_`i' `cut'
return local lrn_`i' `lrn'
return local lrp_`i' `lrp'
return local corr_`i' `corr'
// Added code end
Find the end of the "prog def MYDETail" subroutine where you find the
statements:
qui replace `sens'=`sens'/100
qui replace `spec'=`spec'/100
just after the two "qui replace" and before the "end" statement insert:
// Added code begin
mkmat `sens' `spec' in 1/`--i', matrix(cut)
return local cuts `i'
// Added code end
After running -roctab2- try a -mat list r(cut)- and -sreturn list- to
see if the necessary information is there.
To test:
use http://www.stata-press.com/data/r9/ct.dta
roctab2 status mod1 , table detail
mat list r(cut)
return list
Note: this information is created in the MYDETail subroutine and is
only available when you specify the detail option.
--
David Elliott
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/