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 at the end of May, and its replacement, statalist.org is already up and running.


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

st: SV: Combining ROC curves in one graph


From   Kim Oren Gradel <kim.gradel@ouh.regionsyddanmark.dk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   st: SV: Combining ROC curves in one graph
Date   Tue, 23 Aug 2011 12:30:20 +0200

Dear Stata-users, 

I have had the same problem, or at least a similar one, and I suggest a solution here:

I have four multivariable logistic regression models. Model 1 has the outcome variable + X variables, Model 2 = Model 1 + var1, Model 3 = Model 1 + var2, and Model 4 = Model 1 + var1 + var2. I wanted the ROC curves from each of these models in one graph and did the following:

/* Model 1: */
xi: logistic i.dod30 age i.kon i.charlindex i.bak i.afdtype_unik
lsens, gensens(sens1) genspec(spec1) replace nodraw
gen spec_1 = 1-spec1
/* Model 2: */
xi: logistic i.dod30 age i.kon i.charlindex i.bak i.afdtype_unik i.sepsis
lsens, gensens(sens2) genspec(spec2) replace nodraw
gen spec_2 = 1-spec2
/* Model 3: */
xi: logistic i.dod30 age i.kon i.charlindex i.bak i.afdtype_unik crp10
lsens, gensens(sens3) genspec(spec3) replace nodraw
gen spec_3 = 1-spec3
/* Model 4: */
xi: logistic i.dod30 age i.kon i.charlindex i.bak i.afdtype_unik i.sepsis crp10
lsens, gensens(sens4) genspec(spec4) replace nodraw
gen spec_4 = 1-spec4
/* This is admittedly primitive, but it works!!!!: */
gen line1=0
replace line1=1 if age>=60
gen line2 = line1

twoway (connect line1 line2, mcolor(black) xlabel(0(0.1)1) ylabel(0(0.1)1 , angle(horizontal)))  /*
*/ (scatter sens1 spec_1 , msymbol(p) mcolor(black) legend(off)) /*
*/ (scatter sens2 spec_2 , msymbol(p) mcolor(red)) /*
*/ (scatter sens3 spec_3 , msymbol(p) mcolor(green)) /*
*/ (scatter sens4 spec_4 , msymbol(p) mcolor(blue))

Your models seem to be univariate, but instead of 

roctab refvar classvar 

you must be able to use

logistics refvar classvar 

Good luck

Kim


Kim Oren Gradel
Epidemiologist, Senior DVM, PhD
The Danish Clinical Quality Improvement Programme
Centre for National Clinical Databases, South
 
OUH Odense University Hospital
Department of Quality and Research / HTA
Sdr. Boulevard 29, Entrance 101, 4th floor, DK-5000 Odense C
Tel: +45 65 41 17 03
Fax: +45 65 91 72 64
E-mail: kim.gradel@ouh.regionsyddanmark.dk
Web: www.KCSinfo.dk
 




 

-----Oprindelig meddelelse-----
Fra: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] På vegne af Kim Peeters
Sendt: 19. august 2011 09:59
Til: Statalist
Emne: st: Combining ROC curves in one graph

Dear Stata-users,

I have plotted three ROC curves using

roctab x1 y1, graph name(rocgraph1) nodraw roctab x2 y2, graph name(rocgraph2) nodraw roctab x3 y3, graph name(rocgraph3) nodraw

How can I combine these three roclines into one graph. || or (...) do not seem to work.

Moreover, I would like to do the same thing after rocfit and rocplot:

rocfit x1 y1
rocplot, confband name(rocfit1) nodraw
rocfit x2 y2
rocplot, confband name(rocfit2) nodraw
rocfit x3 y3
rocplot, confband name(rocfit3) nodraw

Thank you for your advice.

P.S. I don't want to array the separately drawn graphs into one using graph combine. I just need one graph that contains all three ROC lines.


Best regards,
Kim
*
*   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/


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