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]
Re: st: Question on ROC analysis
From
Steven Samuels <[email protected]>
To
[email protected]
Subject
Re: st: Question on ROC analysis
Date
Mon, 23 May 2011 18:28:56 -0400
Megan,
I suspect an incomplete download of -somersd-. But there could also be a mistake in your code. As the FAQ request, please show us exactly what you typed, as well as what Stata responded.
I misread your original question and missed the implication that lower values of x are associated with lower values of y. To get a large AUC, do the analysis with -x. Or indicate that Y is greater than the cutpoint. Either -somersd- or -roctab- will work (ylow vs -x or yhigh vs x), though -somersd- has the advantage, among others, that it takes probability weights.
***********************
sysuse auto, clear
gen y = 1/mpg
gen ylow = y<.05
gen yhigh = 1-ylow
gen x = weight
gen nx = -x
scatter y x
roctab ylow nx, graph //graphs the curve for -x
roctab ylow nx // produce the AUC for -x
roctab yhigh x // same
roctab ylow x // AUC for x
di .50 + (.50 -r(area)) // AUC for -x
/* somersd */
somersd ylow nx, tr(c) // also produces the AUC for -x
somersd ylow x, tr(c) // AUC for x
di .50 + (.50 - _b[x]) // also AUC for -x
**********************
Steve
[email protected]
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 <[email protected]> wrote:
>
> Roger -senspec- from SSC should do what you want.
>
> Steve
> [email protected]
>
> 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/