<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Overlay ROC curves that have different outcomes in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Overlay-ROC-curves-that-have-different-outcomes/m-p/777873#M22220</link>
    <description>&lt;P&gt;Use the OUTROC= option on the MODEL statement to output the points for each ROC curve. Merge the two curves. Use SGPLOT to overlay the two curves:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*Make example dataset;
data test ( keep = anemia allergy weight visit );
 set sashelp.bweight;
 if _N_ &amp;lt;= 100;
 anemia = black;
 allergy = married;
run;

*Outcome = ANEMIA;
proc logistic data = test descending;
 model anemia = weight visit / outroc=ROC1;
 run; quit;
*Outcome = ALLERGY;
proc logistic data = test descending;
 model allergy = weight visit / outroc=ROC2;
run; quit;

/* merge in the population ROC curve */
data ROCAll;
   set ROC1(in=r1) ROC2;
   if r1 then Model=1;
   else Model = 2;
run;

title "Compare ROC Curves for Different Models";
proc sgplot data=ROCAll aspect=1 noautolegend;
   step x=_1MSPEC_ y=_SENSIT_ / group=Model;
   lineparm x=0 y=0 slope=1 / lineattrs=(color=gray);
   xaxis grid;   yaxis grid;
   label _1MSPEC_ ="False Positive Rate (FPR)" _SENSIT_ ="True Positive Rate (TPR)";
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 02 Nov 2021 10:55:30 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2021-11-02T10:55:30Z</dc:date>
    <item>
      <title>Overlay ROC curves that have different outcomes</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Overlay-ROC-curves-that-have-different-outcomes/m-p/777818#M22219</link>
      <description>&lt;P&gt;I've seen instructions for how to overlay ROC curves when the outcome is the same across models but not when they're different. For example, is it possible to overlay these two ROC curves that have the same predictors but different outcomes?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*Make example dataset;
data test ( keep = anemia allergy weight visit );
 set sashelp.bweight;
 if _N_ &amp;lt;= 100;
 anemia = black;
 allergy = married;
run;

*Outcome = ANEMIA;
proc logistic data = test descending;
 model anemia = weight visit;
 roc weight visit;
run; quit;

*Outcome = ALLERGY;
proc logistic data = test descending;
 model allergy = weight visit;
 roc weight visit;
run; quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Nov 2021 03:24:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Overlay-ROC-curves-that-have-different-outcomes/m-p/777818#M22219</guid>
      <dc:creator>bkq32</dc:creator>
      <dc:date>2021-11-02T03:24:05Z</dc:date>
    </item>
    <item>
      <title>Re: Overlay ROC curves that have different outcomes</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Overlay-ROC-curves-that-have-different-outcomes/m-p/777873#M22220</link>
      <description>&lt;P&gt;Use the OUTROC= option on the MODEL statement to output the points for each ROC curve. Merge the two curves. Use SGPLOT to overlay the two curves:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*Make example dataset;
data test ( keep = anemia allergy weight visit );
 set sashelp.bweight;
 if _N_ &amp;lt;= 100;
 anemia = black;
 allergy = married;
run;

*Outcome = ANEMIA;
proc logistic data = test descending;
 model anemia = weight visit / outroc=ROC1;
 run; quit;
*Outcome = ALLERGY;
proc logistic data = test descending;
 model allergy = weight visit / outroc=ROC2;
run; quit;

/* merge in the population ROC curve */
data ROCAll;
   set ROC1(in=r1) ROC2;
   if r1 then Model=1;
   else Model = 2;
run;

title "Compare ROC Curves for Different Models";
proc sgplot data=ROCAll aspect=1 noautolegend;
   step x=_1MSPEC_ y=_SENSIT_ / group=Model;
   lineparm x=0 y=0 slope=1 / lineattrs=(color=gray);
   xaxis grid;   yaxis grid;
   label _1MSPEC_ ="False Positive Rate (FPR)" _SENSIT_ ="True Positive Rate (TPR)";
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Nov 2021 10:55:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Overlay-ROC-curves-that-have-different-outcomes/m-p/777873#M22220</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2021-11-02T10:55:30Z</dc:date>
    </item>
    <item>
      <title>Re: Overlay ROC curves that have different outcomes</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Overlay-ROC-curves-that-have-different-outcomes/m-p/777886#M22221</link>
      <description>&lt;PRE&gt;data test ( keep = anemia allergy weight visit );
 set sashelp.bweight;
 if _N_ &amp;lt;= 100;
 anemia = black;
 allergy = married;
run;





ods select none;
*Outcome = ANEMIA;
proc logistic data = test descending  ;
 model anemia = weight visit/outroc=roc1;
 ods output Association=Association1;
run;
*Outcome = ALLERGY;
proc logistic data = test descending  ;
 model allergy = weight visit/outroc=roc2;
 ods output Association=Association2;
run; 
ods select all;






proc sql noprint;
select cValue2 into :auc1 from Association1 where Label2='c';
select cValue2 into :auc2 from Association2 where Label2='c';
quit;
data roc;
 set roc1 roc2 indsname=dsn;
 model=scan(dsn,-1,'.');
run;
proc sgplot data=roc aspect=1;
series x=_1MSPEC_ y=_SENSIT_/group=model;
lineparm x=0 y=0 slope=1/lineattrs=(color=verylightgray);
xaxis grid valuesformat=F8.2;
yaxis grid valuesformat=F8.2;
inset "ROC1=&amp;amp;auc1." "ROC2=&amp;amp;auc2.";
run;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Nov 2021 11:55:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Overlay-ROC-curves-that-have-different-outcomes/m-p/777886#M22221</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-11-02T11:55:58Z</dc:date>
    </item>
    <item>
      <title>Re: Overlay ROC curves that have different outcomes</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Overlay-ROC-curves-that-have-different-outcomes/m-p/778011#M22226</link>
      <description>Thank you, both!</description>
      <pubDate>Tue, 02 Nov 2021 19:55:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Overlay-ROC-curves-that-have-different-outcomes/m-p/778011#M22226</guid>
      <dc:creator>bkq32</dc:creator>
      <dc:date>2021-11-02T19:55:12Z</dc:date>
    </item>
  </channel>
</rss>

