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 |
Charles Lindsey <clindsey@stata.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Combining ROC curves in one graph |

Date |
Fri, 19 Aug 2011 16:25:39 -0500 |

Kim Peters wrote: > 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. All the receiver operating characteristic (ROC) commands in Stata use a

Kim can use the new command -rocreg- to draw the graph she desires. Here is a short answer to Kim's question. You can use -rocreg- to fit several models, create the new variables containing the false-positive rate and ROC values, and then plot the ROC curves using -twoway-. Here is a more detailed answer to Kim's question. Let's consider an example using the Hanley data, where an individual's neurological disease status is classified on a single 5-scale rating.

. set seed 12345671 . webuse hanley, clear . generate ndisease = disease . replace ndisease = 0 if runiform() > .8

. quietly rocreg disease rating, nobootstrap

. rename _roc_rating roc_disease . rename _fpr_rating fpr_disease Now we run -rocreg- on the -ndisease- status variable. . quietly rocreg ndisease rating, nobootstrap We rename the generated ROC and false-positive rate variables that this execution of rocreg creates. . rename _roc_rating roc_ndisease . rename _fpr_rating fpr_ndisease

. twoway scatter roc_disease fpr_disease, connect(J) sort || /// scatter roc_ndisease fpr_ndisease, connect(J) sort /// legend(label(1 disease) label(2 ndisease)) Kim Peters also wrote: > 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 > > 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.

Charles Lindsey, StataCorp * * 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/

**References**:**st: Combining ROC curves in one graph***From:*Kim Peeters <kimpeeters84@yahoo.com>

- Prev by Date:
**Re: st: mac editor for big files** - Next by Date:
**Re: st: sampsi** - Previous by thread:
**st: Combining ROC curves in one graph** - Next by thread:
**st: SV: Combining ROC curves in one graph** - Index(es):