<?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: Comparing of two ROC curves, one with manually input in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Comparing-of-two-ROC-curves-one-with-manually-input/m-p/512054#M73088</link>
    <description>&lt;P&gt;Create a data set that contains the observed responses and the predicted probabilities for each model (including the manually generated probabilities). Then you can use the ROC statement in PROC LOGISTIC to create and overlay the ROC curves. The syntax will look like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc logistic data=Have;
   model Y = LogiPred ManualPred / nofit;
   roc 'Logistic' pred=LogiPred ;
   roc 'Expert'   pred=ManualPred;
   ods select ROCCurve ROCOverlay;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For more discussion and an example&amp;nbsp;that shows how to create and overlay ROC curves, see the article &lt;A href="https://blogs.sas.com/content/iml/2018/11/14/compare-roc-curves-sas.html" target="_self"&gt;"Create and compare ROC curves for any predictive model."&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 14 Nov 2018 10:33:57 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2018-11-14T10:33:57Z</dc:date>
    <item>
      <title>Comparing of two ROC curves, one with manually input</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Comparing-of-two-ROC-curves-one-with-manually-input/m-p/511404#M73061</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am currently writing my master thesis with SAS. Therefore, I want to compare two ROC curves within the PROC LOGISTIC Procedure:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One ROC curve will be calculated with the following model:&lt;/P&gt;&lt;P&gt;model DEAL (event='1') =&amp;nbsp; PRES44_1 SIGNAL3_1 COMCOM4_1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For the other curve I have a variable with estimated probabilities as a manually input from my study participants. The binary response (dependent variable) is the same for both curves (DEAL).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I like to find out if it is possible to compare both curves regarding the area under the curves?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would be very glad to get an answer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Joerg&lt;/P&gt;</description>
      <pubDate>Thu, 08 Nov 2018 15:13:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Comparing-of-two-ROC-curves-one-with-manually-input/m-p/511404#M73061</guid>
      <dc:creator>JOTE</dc:creator>
      <dc:date>2018-11-08T15:13:44Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing of two ROC curves, one with manually input</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Comparing-of-two-ROC-curves-one-with-manually-input/m-p/511673#M73069</link>
      <description>&lt;P&gt;Using OUTPUT statement to save probability. and Plot ROC by yourself.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
/********Plot ROC curve***********/
options validvarname=any;
libname x v9 'D:\工作文件\花生好车2\备份\hs_data' access=readonly;

data have;
 set x.score_card;
 keep good_bad total_score;
run;

proc sort data=have(keep=total_score) out=score nodupkey;
by descending total_score;
run;
data score;
 set score end=last;
 output;
 if last then do;total_score=total_score-1;output;end;
run;
proc sort data=score;
by total_score;
run;

proc sort data=have;
by good_bad total_score;
run;



proc delete data=want;run;
%macro roc(score=);
data temp;
 set have;
 if total_score&amp;lt;=&amp;amp;score then score_good_bad='bad ';
  else score_good_bad='good';
run;
proc sql;
create table temp1 as
 select good_bad,sum(score_good_bad='good')/count(*) as percent
  from temp
   group by good_bad;
quit;
proc transpose data=temp1 out=temp2;
id good_bad;
var percent;
run;
data temp3;
 set temp2(rename=(good=sensitity bad=_1_minus_specifity));
 score=&amp;amp;score;
 drop _name_;
run;
proc append base=want data=temp3 force;
run;
%mend;



data _null_;
 set score;
 call execute(cats('%roc(score=',total_score,')'));
run;



data roc;
 set want;
 dx=-dif(_1_minus_specifity);
 dy=mean(sensitity,lag(sensitity));
 roc=dx*dy;
run;

proc sql noprint;
select sum(roc) into : roc from roc;
quit;




proc sgplot data=want aspect=1 noautolegend;
lineparm x=0 y=0 slope=1/lineattrs=(color=grey);
series x=_1_minus_specifity y=sensitity;
inset "ROC = &amp;amp;roc"/position=topleft;
xaxis grid;
yaxis grid;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Nov 2018 13:40:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Comparing-of-two-ROC-curves-one-with-manually-input/m-p/511673#M73069</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-11-09T13:40:49Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing of two ROC curves, one with manually input</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Comparing-of-two-ROC-curves-one-with-manually-input/m-p/512054#M73088</link>
      <description>&lt;P&gt;Create a data set that contains the observed responses and the predicted probabilities for each model (including the manually generated probabilities). Then you can use the ROC statement in PROC LOGISTIC to create and overlay the ROC curves. The syntax will look like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc logistic data=Have;
   model Y = LogiPred ManualPred / nofit;
   roc 'Logistic' pred=LogiPred ;
   roc 'Expert'   pred=ManualPred;
   ods select ROCCurve ROCOverlay;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For more discussion and an example&amp;nbsp;that shows how to create and overlay ROC curves, see the article &lt;A href="https://blogs.sas.com/content/iml/2018/11/14/compare-roc-curves-sas.html" target="_self"&gt;"Create and compare ROC curves for any predictive model."&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2018 10:33:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Comparing-of-two-ROC-curves-one-with-manually-input/m-p/512054#M73088</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2018-11-14T10:33:57Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing of two ROC curves, one with manually input</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Comparing-of-two-ROC-curves-one-with-manually-input/m-p/512149#M73093</link>
      <description>&lt;P&gt;Hi Rick,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help. I did not know the /nofit option.&lt;/P&gt;&lt;P&gt;Now, I can also test the differences between the ROC curves:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc logistic data=s4y.dealpred plots=roc(id=prob);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; model DEAL (event='1') =&amp;nbsp; PRED_ PROBFORE_PZ / nofit;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; roc 'Expert' PROBFORE_PZ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; roc 'Logistic' PRED_;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; roccontrast;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Joerg&lt;/P&gt;</description>
      <pubDate>Mon, 12 Nov 2018 11:17:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Comparing-of-two-ROC-curves-one-with-manually-input/m-p/512149#M73093</guid>
      <dc:creator>JOTE</dc:creator>
      <dc:date>2018-11-12T11:17:44Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing of two ROC curves, one with manually input</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Comparing-of-two-ROC-curves-one-with-manually-input/m-p/528067#M73593</link>
      <description>&lt;P&gt;Hi Rick,&lt;/P&gt;&lt;P&gt;I am still struggling with my master thesis. There is one question left regarding the comparing of two ROC curves with the DeLong approach. My hypothesis is formulated in way that it needs a one-tailed chi-square-test, meaning I claimed that the difference of the areas between LOGISTIC_LOO and EXPERT is positive:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ROC.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/26350i82810239F7DC0F83/image-size/large?v=v2&amp;amp;px=999" role="button" title="ROC.JPG" alt="ROC.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Can I halve the p-value for the described scenario?&lt;/P&gt;&lt;P&gt;Would be very glad to get a quick answer if possible.&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Joerg&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2019 15:22:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Comparing-of-two-ROC-curves-one-with-manually-input/m-p/528067#M73593</guid>
      <dc:creator>JOTE</dc:creator>
      <dc:date>2019-01-17T15:22:48Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing of two ROC curves, one with manually input</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Comparing-of-two-ROC-curves-one-with-manually-input/m-p/528078#M73594</link>
      <description>&lt;P&gt;&amp;gt;&amp;nbsp;&lt;SPAN&gt;Can I halve the p-value for the described scenario?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I don't think so. Chi-square tests are one-sided by their construction.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Your contrast shows that the area under the two ROC curves are not significantly different at the alpha=0.05 significance level. The best you can claim is that they are (barely) different for alpha=0.1, and the estimate shows that&amp;nbsp;LOGISTIC_LOO&amp;nbsp;is greater in area than EXPERT.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jan 2019 15:54:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Comparing-of-two-ROC-curves-one-with-manually-input/m-p/528078#M73594</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2019-01-17T15:54:44Z</dc:date>
    </item>
    <item>
      <title>Re: Comparing of two ROC curves, one with manually input</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Comparing-of-two-ROC-curves-one-with-manually-input/m-p/528260#M73613</link>
      <description>&lt;P&gt;Hi Rick,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your quick and clear answer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Joerg&lt;/P&gt;</description>
      <pubDate>Fri, 18 Jan 2019 08:04:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Comparing-of-two-ROC-curves-one-with-manually-input/m-p/528260#M73613</guid>
      <dc:creator>JOTE</dc:creator>
      <dc:date>2019-01-18T08:04:24Z</dc:date>
    </item>
  </channel>
</rss>

