Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Question on ROC analysis


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Question on ROC analysis
Date   Tue, 24 May 2011 16:01:58 +0100

Note also that Stata has a function -atanh()-.

Nick

On Tue, May 24, 2011 at 2:43 PM, Steven Samuels <sjsamuels@gmail.com> wrote:
> Megan,
>
> Another advantage of using -somersd-: It can produce asymmetric confidence intervals for the AUC, which will often be more accurate for high or low values of the AUC. You do this by computing the intervals for Fisher's Z transform of Somers' D statistic, then transforming them by hand to intervals for the AUC ("Harrell's c").
>
> Ref: Roger Newson Confidence intervals for rank statistics: Somers’ D and extensions.  The Stata Journal (2006) 6, Number 3, pp. 309–334 available at: http://www.stata-journal.com/article.html?article=snp15_6
>
> **************************CODE BEGINS*******
> sysuse auto, clear
> gen y = 1/mpg
> gen ylow = y<.05
> gen yhigh = 1-ylow
> gen x = weight
> gen nx = -x
>
> somersd ylow nx, tdist tr(z)
> matrix b = e(b)
> local z= b[1,1]
> matrix v=e(V)
> local v =v[1,1]
>
> local bound = sqrt(`v')*invttail(e(df_r),0.5*(1-c(level)/100))
> local ll   = `z'-`bound'
> local ul   = `z' + `bound'
> local auc  = (exp(2*`z')-1)/(exp(2*`z')+1)
> local auc  = (`auc'+1)/2
> local llim = (exp(2*`ll')-1)/(exp(2*`ll')+1)
> local llim = (`llim'+1)/2
> local ulim = (exp(2*`ul')-1)/(exp(2*`ul')+1)
> local ulim = (`ulim'+1)/2
> //asymmetric interval
> di "Asymmetric: auc ="%9.7g `auc' " llim ="%9.7g `llim'  " ulim ="%9.7g `ulim'
> // compare to symmetric interval:
> somersd ylow nx, tdist tr(c)
> **************************CODE ENDS*******
>

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


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index