<?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: Calibration plot for large number of observations in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Calibration-plot-for-large-number-of-observations/m-p/881529#M348321</link>
    <description>&lt;P&gt;Please show us the &lt;FONT color="#FF0000"&gt;ENTIRE&lt;/FONT&gt; log for this PROC LOGISTIC code — that's every single line in the log for PROC LOGISTIC, every single character in the log for PROC LOGISTIC.&lt;/P&gt;</description>
    <pubDate>Tue, 20 Jun 2023 11:57:39 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2023-06-20T11:57:39Z</dc:date>
    <item>
      <title>Calibration plot for large number of observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calibration-plot-for-large-number-of-observations/m-p/881526#M348319</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope you're well - wondering if you could help me with a query I had for calibration plots.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Am validating&amp;nbsp; a logistic regression model in a large dataset (n=384,616).&amp;nbsp;I can get the ROC curve to work but the calibration plot won't display.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Would anyone be able to modify my code (below) so the calibration plot will work?&lt;/P&gt;
&lt;P style="line-height: 1.71429; font-family: 'SAS Font', Arial, Helvetica, sans-serif;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="line-height: 1.71429; font-family: 'SAS Font', Arial, Helvetica, sans-serif;"&gt;Many thanks,&amp;nbsp;&lt;/P&gt;
&lt;P style="line-height: 1.71429; font-family: 'SAS Font', Arial, Helvetica, sans-serif;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="line-height: 1.71429; font-family: 'SAS Font', Arial, Helvetica, sans-serif;"&gt;Craig&amp;nbsp;&lt;/P&gt;
&lt;P style="line-height: 1.71429; font-family: 'SAS Font', Arial, Helvetica, sans-serif;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC LOGISTIC DATA=BIO3 PLOTS = ROC PLOTS(MAXPOINTS=NONE) 
 plots=calibration(CLM ShowObs);
MODEL HNC(EVENT='HNC') = PROB / ROCCI GOF OUTROC = ROC;
RUN; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2023 11:40:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calibration-plot-for-large-number-of-observations/m-p/881526#M348319</guid>
      <dc:creator>CraigSmith</dc:creator>
      <dc:date>2023-06-20T11:40:51Z</dc:date>
    </item>
    <item>
      <title>Re: Calibration plot for large number of observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calibration-plot-for-large-number-of-observations/m-p/881529#M348321</link>
      <description>&lt;P&gt;Please show us the &lt;FONT color="#FF0000"&gt;ENTIRE&lt;/FONT&gt; log for this PROC LOGISTIC code — that's every single line in the log for PROC LOGISTIC, every single character in the log for PROC LOGISTIC.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2023 11:57:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calibration-plot-for-large-number-of-observations/m-p/881529#M348321</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-06-20T11:57:39Z</dc:date>
    </item>
    <item>
      <title>Re: Calibration plot for large number of observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calibration-plot-for-large-number-of-observations/m-p/881533#M348322</link>
      <description>I think there are must too many obs in your GRAPH  to suppress calibration plot.&lt;BR /&gt;&lt;BR /&gt;Or you could use PROC SGPLOT+ LOESS to get it.&lt;BR /&gt;Check &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt; 's blog:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/iml/2018/05/14/calibration-plots-in-sas.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2018/05/14/calibration-plots-in-sas.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/iml/2018/05/16/decile-calibration-plots-sas.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2018/05/16/decile-calibration-plots-sas.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/iml/2019/02/20/easier-calibration-plot-sas.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2019/02/20/easier-calibration-plot-sas.html&lt;/A&gt;</description>
      <pubDate>Tue, 20 Jun 2023 12:08:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calibration-plot-for-large-number-of-observations/m-p/881533#M348322</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-06-20T12:08:30Z</dc:date>
    </item>
    <item>
      <title>Re: Calibration plot for large number of observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calibration-plot-for-large-number-of-observations/m-p/881924#M348469</link>
      <description>&lt;P&gt;Hi Paige,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry was on a course w limited access to device.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;here is the&amp;nbsp; corresponding log&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;1643
1644  PROC LOGISTIC DATA=BIO3 PLOTS = ROC PLOTS(MAXPOINTS=NONE)
1645   plots=calibration(CLM ShowObs);
1646  MODEL HNC(EVENT='HNC') = PROB / ROCCI GOF OUTROC = ROC;
1647  RUN;

NOTE: PROC LOGISTIC is modeling the probability that HNC='HNC'.
NOTE: Convergence criterion (GCONV=1E-8) satisfied.
WARNING: This graph has too many graphical elements. You may
         not be able to get any vector graphics output and in
         that case, you can set your output format to an image
         type.
WARNING: This graph has too many graphical elements. You may
         not be able to get any vector graphics output and in
         that case, you can set your output format to an image
         type.
NOTE: The number of observations of the LOESS plot (384616)
      exceeds the limit of 5000. Specify the LOESSMAXOBS option
      of the ODS GRAPHICS statement to override the limit.
NOTE: The number of observations of the LOESS plot (384616)
      exceeds the limit of 5000. Specify the LOESSMAXOBS option
      of the ODS GRAPHICS statement to override the limit.
NOTE: There were 384616 observations read from the data set
      WORK.BIO3.
NOTE: The data set WORK.ROC has 77689 observations and 8
      variables.
NOTE: PROCEDURE LOGISTIC used (Total process time):
      real time           4:43.01
      cpu time            3:42.45
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jun 2023 15:14:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calibration-plot-for-large-number-of-observations/m-p/881924#M348469</guid>
      <dc:creator>CraigSmith</dc:creator>
      <dc:date>2023-06-22T15:14:18Z</dc:date>
    </item>
    <item>
      <title>Re: Calibration plot for large number of observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calibration-plot-for-large-number-of-observations/m-p/882321#M348605</link>
      <description>&lt;P&gt;Hi Ksharp,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I see&amp;nbsp; - thank you. Would it be possible for you to write an example with it please? Not quite sure how to do it.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;C&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 25 Jun 2023 16:28:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calibration-plot-for-large-number-of-observations/m-p/882321#M348605</guid>
      <dc:creator>CraigSmith</dc:creator>
      <dc:date>2023-06-25T16:28:38Z</dc:date>
    </item>
    <item>
      <title>Re: Calibration plot for large number of observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calibration-plot-for-large-number-of-observations/m-p/882416#M348626</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*
I think your obs is too big to use LOESS to get calibration plot.
Try "Decile calibration plots" ,
The following code is from :
https://blogs.sas.com/content/iml/2018/05/16/decile-calibration-plots-sas.html
*/

data have;
 set sashelp.heart sashelp.heart sashelp.heart sashelp.heart sashelp.heart
     sashelp.heart sashelp.heart sashelp.heart sashelp.heart sashelp.heart;
if status='Alive' then y=0;else y=1;
run;


/* Use PROC LOGISTIC and output the predicted probabilities.
   Intentionally MISSPECIFY the model as linear. */
proc logistic data=have noprint;
   model y(event='1') = weight height;
   output out=LogiOut predicted=PredProb; /* save predicted probabilities in data set */
run;
 
/* To construct the decile calibration plot, identify deciles of the predicted prob. */
proc rank data=LogiOut out=LogiDecile groups=10;
   var PredProb;
   ranks Decile;
run;
 
/* Then compute the mean predicted prob and the empirical proportions (and CI) for each decile */
proc means data=LogiDecile noprint;
   class Decile;
   types Decile;
   var y PredProb;
   output out=LogiDecileOut mean=yMean PredProbMean
          lclm=yLower uclm=yUpper;
run;
 
title "Calibration Plot for Misspecified Model";
title2 "True Model Is Quadratic; Fit Is Linear";
proc sgplot data=LogiDecileOut noautolegend aspect=1;
   lineparm x=0 y=0 slope=1 / lineattrs=(color=grey pattern=dash) clip;
   *loess x=PredProbMean y=yMean;  /* if you want a smoother based on deciles */
   series x=PredProbMean y=yMean;  /* if you to connect the deciles */
   scatter x=PredProbMean y=yMean / yerrorlower=yLower yerrorupper=yUpper;
   yaxis label="Observed Probability of Outcome";
   xaxis label="Predicted Probability of Outcome";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1687781218623.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/85391iFF979E0D2A13C181/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1687781218623.png" alt="Ksharp_0-1687781218623.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jun 2023 12:06:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calibration-plot-for-large-number-of-observations/m-p/882416#M348626</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-06-26T12:06:49Z</dc:date>
    </item>
    <item>
      <title>Re: Calibration plot for large number of observations</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calibration-plot-for-large-number-of-observations/m-p/882652#M348720</link>
      <description>&lt;P&gt;Hey Ksharp,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for this - this code is a bit too complex for me but I'll see if our statistician can get this running.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Many thanks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Craig&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jun 2023 14:59:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calibration-plot-for-large-number-of-observations/m-p/882652#M348720</guid>
      <dc:creator>CraigSmith</dc:creator>
      <dc:date>2023-06-27T14:59:08Z</dc:date>
    </item>
  </channel>
</rss>

