<?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: Comparison of ROC curves - overlay two curves in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Comparison-of-ROC-curves-overlay-two-curves/m-p/944763#M370161</link>
    <description>&lt;P&gt;Thank you for the suggestion. I will take another look at the data and your code.&lt;/P&gt;&lt;P&gt;I appreciate your help.&lt;/P&gt;</description>
    <pubDate>Fri, 20 Sep 2024 15:19:06 GMT</pubDate>
    <dc:creator>talktorob</dc:creator>
    <dc:date>2024-09-20T15:19:06Z</dc:date>
    <item>
      <title>Comparison of ROC curves - overlay two curves</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparison-of-ROC-curves-overlay-two-curves/m-p/944664#M370125</link>
      <description>&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;I am comparing the ROC-AUC of two algorithms in one dataset. I obtained the first ROC-AUC value (0.7003) after running the proc logistic statement using the base model of the algorithm. I output the estimated probabilities in a new dataset and then use this dataset to run the second proc logistic statement and obtain the ROC-AUC value (0.7031) on the enhanced model of the algorithm.&lt;/P&gt;&lt;P&gt;The goal is to overlay both ROC curves. When I run the next proc logistic statement the ROC-AUC value from the base model changes (from 0.7003 to 0.698), while the enhanced model ROC-AUC value remains the same (0.7031).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have included my code below for the three proc logistic statements. I was wondering if someone could point out the error in my code. I am not sure why the ROC-AUC value changes in the base model when the last set of code overlays the two ROC curves.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you so much for your help. Please let me know if there is any other information I can provide.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*ROC curve for base model ;&lt;BR /&gt;proc logistic data=ROCmerge plots(only)=roc ;&lt;BR /&gt;where stroke_time &amp;lt;= 10 ;&lt;BR /&gt;model instroke(event='1') = BASESTROKEMODELRISKPCT / outroc=Baseroc ;&lt;BR /&gt;output out=BASEpredict pred=BASEPROB;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;*ROC curve for enhanced model ;&lt;BR /&gt;proc logistic data=BASEpredict plots(only)=roc ;&lt;BR /&gt;where stroke_time &amp;lt;= 10 ;&lt;BR /&gt;model instroke(event="1") = FULLSTROKEMODELRISKPCT / outroc=Fullroc ;&lt;BR /&gt;output out=FULLpredict pred=FULLPROB ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;*Overlay ROC curves ;&lt;/P&gt;&lt;P&gt;proc logistic data=FULLpredict ;&lt;BR /&gt;where stroke_time &amp;lt;= 10 ;&lt;BR /&gt;model instroke(event= "1" ) = BASEPROB FULLPROB / nofit ;&lt;/P&gt;&lt;P&gt;roc 'Base' pred=BASEPROB ;&lt;BR /&gt;roc 'Full' pred=FULLPROB ;&lt;/P&gt;&lt;P&gt;roccontrast ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2024 19:55:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparison-of-ROC-curves-overlay-two-curves/m-p/944664#M370125</guid>
      <dc:creator>talktorob</dc:creator>
      <dc:date>2024-09-19T19:55:50Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison of ROC curves - overlay two curves</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparison-of-ROC-curves-overlay-two-curves/m-p/944676#M370134</link>
      <description>&lt;P&gt;Are you asking "Why when I change the values / variables used in the model does one of the output statistics change?"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the goal is to overlay the graph curves and not generate a third model with different data then use ODS OUTPUT to capture the data used to show the graphs.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc logistic data=ROCmerge plots(only)=roc ;
where stroke_time &amp;lt;= 10 ;
model instroke(event='1') = BASESTROKEMODELRISKPCT / outroc=Baseroc ;
output out=BASEpredict pred=BASEPROB;

ods output fitplot=basefitplot;

run;&lt;/PRE&gt;
&lt;P&gt;This will create data set with the information used for most of the graph. The variables _xcont1 and _predicted have the x,y coordinates of the basic prediction (ROC) curve.&lt;/P&gt;
&lt;P&gt;Create similar data set for the other model.&lt;/P&gt;
&lt;P&gt;Combine them adding a variable to identify which model is the source to use as a GROUP variable and use Sgplot to plot the _xcont1 and _predicted series.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data toplot;
   set basefitplot (in=inbase)
       fullfitplot (in=infull)
   ;
   if inbase the Plot='Base';
   else if infull then Plot='Full';
run;

proc sgplot data=toplot;
   series x=_xcont1 y=_predicted /group=plot;
run;&lt;/PRE&gt;
&lt;P&gt;The variables _lclm and _uclm could be used with a BAND plot for the Lower and Upper variables as well.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Sep 2024 21:14:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparison-of-ROC-curves-overlay-two-curves/m-p/944676#M370134</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-09-19T21:14:17Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison of ROC curves - overlay two curves</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparison-of-ROC-curves-overlay-two-curves/m-p/944689#M370144</link>
      <description>&lt;P&gt;It is hard to give you some advices if you don't post a real dataset .&lt;/P&gt;
&lt;P&gt;And I am unable to replicate your problem. Here is the code I used:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc logistic data=sashelp.heart(obs=2000);
model status= height /outroc=roc1;
output out=want1 p=pred1;
run;
proc logistic data=want1;
model status= weight /outroc=roc2;
output out=want2 p=pred2;
run;
proc logistic data=want2  ;
model status=pred1 pred2/nofit;
roc 'roc1' pred=pred1;
roc 'roc2' pred=pred2;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;To overlay ROC ,check :&lt;BR /&gt;&lt;A href="https://support.sas.com/kb/52/973.html" target="_blank" rel="noopener"&gt;https://support.sas.com/kb/52/973.html&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://support.sas.com/kb/45/339.html" target="_blank" rel="noopener"&gt;https://support.sas.com/kb/45/339.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2024 01:01:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparison-of-ROC-curves-overlay-two-curves/m-p/944689#M370144</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-09-20T01:01:30Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison of ROC curves - overlay two curves</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparison-of-ROC-curves-overlay-two-curves/m-p/944692#M370146</link>
      <description>&lt;P&gt;I am attaching an excel sheet with the data. I use: 1) model instroke(event='1') = BASESTROKEMODELRISKPCT to output the first ROC-AUC curve; and 2)&amp;nbsp;model instroke(event="1") = FULLSTROKEMODELRISKPCT to output the second ROC-AUC curve.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can't get the first ROC-AUC curve to overlay with the second curve, without the first ROC-AUC curve value changing.&lt;/P&gt;&lt;P&gt;I tried the ods output fitplot=basefitplot and received this error message "Output 'fitplot' was not created. Make sure that the output object name, label, or path&lt;BR /&gt;is spelled correctly. Also, verify that the appropriate procedure options are used to&amp;nbsp;produce the requested output object. For example, verify that the NOPRINT option is not&amp;nbsp;used."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for looking this over.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2024 01:43:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparison-of-ROC-curves-overlay-two-curves/m-p/944692#M370146</guid>
      <dc:creator>talktorob</dc:creator>
      <dc:date>2024-09-20T01:43:29Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison of ROC curves - overlay two curves</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparison-of-ROC-curves-overlay-two-curves/m-p/944693#M370147</link>
      <description>&lt;P&gt;I tried the ods output fitplot=basefitplot and received this error message "Output 'fitplot' was not created. Make sure that the output object name, label, or path&lt;BR /&gt;is spelled correctly. Also, verify that the appropriate procedure options are used to&amp;nbsp;produce the requested output object. For example, verify that the NOPRINT option is not&amp;nbsp;used."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for looking this over.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2024 01:45:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparison-of-ROC-curves-overlay-two-curves/m-p/944693#M370147</guid>
      <dc:creator>talktorob</dc:creator>
      <dc:date>2024-09-20T01:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison of ROC curves - overlay two curves</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparison-of-ROC-curves-overlay-two-curves/m-p/944695#M370149</link>
      <description>&lt;P&gt;"(from 0.7003 to 0.698)"&lt;BR /&gt;I think difference 0.001 or 0.002 is very little tolence, you can ignore it .&lt;BR /&gt;And I found an interesting thing is&lt;STRONG&gt; if you polt these two ROC seperatedly one by one ,not overlay, you could get the same result.&lt;/STRONG&gt;&lt;BR /&gt;Maybe the X value used to calculated ROC are different when overlay these two ROC curves.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;

proc logistic data=sashelp.heart(obs=2000);
model status= height /outroc=roc1;
output out=want1 p=pred1;
run;
proc logistic data=want1;
model status= weight /outroc=roc2;
output out=want2 p=pred2;
run;


proc logistic data=want2  ;   /***&amp;lt;--- For the first ROC*******/
model status=pred1/nofit;
roc 'roc1' pred=pred1;
run;
proc logistic data=want2  ;  /***&amp;lt;--- For the second ROC*******/
model status=pred2/nofit;
roc 'roc2' pred=pred2;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Sep 2024 03:23:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparison-of-ROC-curves-overlay-two-curves/m-p/944695#M370149</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-09-20T03:23:11Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison of ROC curves - overlay two curves</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparison-of-ROC-curves-overlay-two-curves/m-p/944696#M370150</link>
      <description>And you can report this question to sas support.</description>
      <pubDate>Fri, 20 Sep 2024 03:24:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparison-of-ROC-curves-overlay-two-curves/m-p/944696#M370150</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-09-20T03:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: Comparison of ROC curves - overlay two curves</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Comparison-of-ROC-curves-overlay-two-curves/m-p/944763#M370161</link>
      <description>&lt;P&gt;Thank you for the suggestion. I will take another look at the data and your code.&lt;/P&gt;&lt;P&gt;I appreciate your help.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2024 15:19:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Comparison-of-ROC-curves-overlay-two-curves/m-p/944763#M370161</guid>
      <dc:creator>talktorob</dc:creator>
      <dc:date>2024-09-20T15:19:06Z</dc:date>
    </item>
  </channel>
</rss>

