Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

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

From |
Steven Samuels <sjsamuels@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Question on ROC analysis |

Date |
Tue, 24 May 2011 09:43:03 -0400 |

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******* Steve sjsamuels@gmail.com On May 23, 2011, at 5:29 PM, Megan Deitchler wrote: Thanks - this helped. I can now graph what I want but am still having trouble calculating the AUC. I am trying to use Roger Newson's somersd package for this, using the c transformation option. I receive the following error: tidotforsomersd(): 3499 tidottree() not found <istmt>: - function returned error Any suggestions? On Thu, May 19, 2011 at 3:19 PM, Steven Samuels <sjsamuels@gmail.com> wrote: > > Roger -senspec- from SSC should do what you want. > > Steve > sjsamuels@gmail.com > > On May 19, 2011, at 2:46 PM, Megan Deitchler wrote: > > I am interested in carrying out a simple two variable ROC analysis. > > I want to assess how well low values of my x variable predict a low value of > my y variable (e.g. y variable with cutoff less than 200). > > However, if I understand correctly, the conventional ROC analysis in Stata > creates the ROC by using incrementally increasing values of x to predict y. > > How do I adapt the analysis so that the AUC result I obtain will > be consistent with the relationship I am interested in quantifying? > > * > * 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/ > > * > * 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/ * * 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/ * * 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/

**Follow-Ups**:**Re: st: Question on ROC analysis***From:*Roger Newson <r.newson@imperial.ac.uk>

**Re: st: Question on ROC analysis***From:*Nick Cox <njcoxstata@gmail.com>

**References**:**st: Question on ROC analysis***From:*Megan Deitchler <mdeitchl@aed.org>

**Re: st: Question on ROC analysis***From:*Steven Samuels <sjsamuels@gmail.com>

**Re: st: Question on ROC analysis***From:*Megan Deitchler <mdeitchl@aed.org>

- Prev by Date:
**st: foreach for interaction term** - Next by Date:
**Re: st: Changing part of variable names** - Previous by thread:
**Re: st: Question on ROC analysis** - Next by thread:
**Re: st: Question on ROC analysis** - Index(es):