<?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: Plotting Calibration curve/line in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/334385#M11640</link>
    <description>&lt;P&gt;Dear Rick:&lt;/P&gt;&lt;P&gt;Thank you so much for the instructions!&lt;/P&gt;&lt;P&gt;Now I'm just one step away from the figure in that article. Below are&amp;nbsp;the codes I learned from you and applied to this question. The dataset was attached in the attachment. The variable phat_mean is the predicted risk by group, and the ob_risk is the observed risk by group. The 10 groups were divided&amp;nbsp;based on&amp;nbsp;the deciles of the predicted risk. My final question is: how to reproduce that dashed diagonal line, which appears to be a reference line,&amp;nbsp;in Figure 1&amp;nbsp;of that article?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sgplot data=ning;&lt;BR /&gt;scatter x=phat_mean y=ob_risk / YErrorLower=Lower_CI YErrorUpper=Upper_CI;&lt;BR /&gt;loess x=phat_mean y=ob_risk;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looking forward to your further instruction!&lt;/P&gt;&lt;P&gt;Many thanks!&lt;/P&gt;&lt;P&gt;Ning&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 20 Feb 2017 17:03:04 GMT</pubDate>
    <dc:creator>bioning</dc:creator>
    <dc:date>2017-02-20T17:03:04Z</dc:date>
    <item>
      <title>Plotting Calibration curve/line</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/82754#M3058</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can anyone help me on how to plot a calibration curve/line with binary outcome? When I plot the predicted probability vs. the actual outcome I get straight line thru 0 and 1 because of binary outcome. I can't seem to figure out otherwise.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Oct 2012 03:23:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/82754#M3058</guid>
      <dc:creator>Rashu</dc:creator>
      <dc:date>2012-10-02T03:23:26Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting Calibration curve/line</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/82755#M3059</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I assume that you have one or more continuous explanatory variables?&lt;/P&gt;&lt;P&gt;I usually use PROC LOGISTIC to model the data and use the PLOTS=EFFECT statement or the newer EFFECTPLOT statement to graph the results:&lt;/P&gt;&lt;P&gt;&lt;A class="active_link" href="http://support.sas.com/documentation/cdl/en/statug/63962/HTML/default/viewer.htm#statug_logistic_sect060.htm#statug.logistic.tlog3f" title="http://support.sas.com/documentation/cdl/en/statug/63962/HTML/default/viewer.htm#statug_logistic_sect060.htm#statug.logistic.tlog3f"&gt;http://support.sas.com/documentation/cdl/en/statug/63962/HTML/default/viewer.htm#statug_logistic_sect060.htm#statug.logistic.tlog3f&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you prefer to do it "by hand," plot the predicted probabilities as Y and the explanatory variable as X.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Oct 2012 12:15:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/82755#M3059</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2012-10-02T12:15:48Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting Calibration curve/line</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/82756#M3060</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rick,&lt;/P&gt;&lt;P&gt;Thank you for you comment. I do have explanatory variables. However, I am not trying to plot the explanatory variable to predicted probability which is what EFFECTPLOT gives. What I am trying to do is plot the predicted probability versus the actual outcome. I already have a model (formula) that I can calculate the predicted probability with but my outcome is binary. So when I plot the predicted versus actual outcome, I get two lines thru o and 1 for binary. I think I need to divided the prob in deciles and plot against the actual frequency and I can seem to figure out how. Please let me know if this makes sense. Thanks for the help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Oct 2012 23:00:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/82756#M3060</guid>
      <dc:creator>Rashu</dc:creator>
      <dc:date>2012-10-03T23:00:42Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting Calibration curve/line</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/82757#M3061</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Unfortunately I am not understanding what you are trying to do. Can you link to a web page that has a picture of what you are trying to achieve?&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Oct 2012 23:28:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/82757#M3061</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2012-10-03T23:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting Calibration curve/line</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/82758#M3062</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is the link of the article. It is similar to what I am trying to do. Figure one is what I am trying to get. Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Oct 2012 02:16:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/82758#M3062</guid>
      <dc:creator>Rashu</dc:creator>
      <dc:date>2012-10-04T02:16:12Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting Calibration curve/line</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/82759#M3063</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The link didn't post.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Oct 2012 09:38:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/82759#M3063</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2012-10-04T09:38:16Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting Calibration curve/line</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/82760#M3064</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="http://igitur-archive.library.uu.nl/med/2006-0906-200629/grobbee_05_assessingtheapplicabilityofscoringsystems.pdf" title="http://igitur-archive.library.uu.nl/med/2006-0906-200629/grobbee_05_assessingtheapplicabilityofscoringsystems.pdf"&gt;http://igitur-archive.library.uu.nl/med/2006-0906-200629/grobbee_05_assessingtheapplicabilityofscoringsystems.pdf&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Oct 2012 13:19:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/82760#M3064</guid>
      <dc:creator>Rashu</dc:creator>
      <dc:date>2012-10-04T13:19:39Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting Calibration curve/line</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/82761#M3065</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK. That's clearer. This isn't really a "graph" question, it's a how do I compute the quantities needed for a graph" question.&lt;/P&gt;&lt;P&gt;Here's what you need:&lt;BR /&gt;1) Compute the deciles of the predicted probabilities&lt;/P&gt;&lt;P&gt;2) For each decile, compute the mean and upper/lower 95% confidence interval for the observed outcome. The mean is also the "percentage of observed values that are 1."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A "short answer" is that you can do it like this:&lt;/P&gt;&lt;P&gt;/* set deciles of predicted risk */&lt;/P&gt;&lt;P&gt;data Deciles;&lt;/P&gt;&lt;P&gt;set Pred;&amp;nbsp; /* data that includes variable PredProb for predicted probabilities */&lt;/P&gt;&lt;P&gt;Decile = int(10*PredProb)/10;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sgplot data=all;&lt;/P&gt;&lt;P&gt;dot decile / response=y stat=mean limitstat=clm;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will get you in the ballpark, and would be sufficient for "internal" plots that you intend for yourself or your group.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Unfortunately there are three problems with this approach if you are trying to EXACTLY reproduce the figure in the paper:&lt;/P&gt;&lt;P&gt;1) The DOT statement displays a graph with the deciles on the vertical axis, which is opposite from the graph in the paper.&lt;/P&gt;&lt;P&gt;2) The LIMITSTAT= option computes confidence limits by using the standard formula for normally distributed data. These data are binary, and therefore you should really use CIs for binomial proportions (not a big deal if you have lots of data, but still...)&lt;/P&gt;&lt;P&gt;3) The plot in the paper also overlays a curve which I assume is a nonparametric smoother (for example, a loess curve) through the (Y, PredProb) points.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All of these problems can be surmounted: call PROC FREQ to get the stats and then overlay the SCATTERPLOT / YUPPERLIMIT= YLOWERLIMIT= statement with a LOESS curve.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Oct 2012 16:19:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/82761#M3065</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2012-10-04T16:19:47Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting Calibration curve/line</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/82762#M3066</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oh, and properly you should use PROC RANK to get the deciles instead of the quick approximation that I used here.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Oct 2012 16:32:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/82762#M3066</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2012-10-04T16:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting Calibration curve/line</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/334235#M11636</link>
      <description>&lt;P&gt;Dear Rick:&lt;/P&gt;&lt;P&gt;Sorry to bother you! Would you please clarify a couple of points&amp;nbsp;regarding the three differences, as you mentioned,&amp;nbsp;between the graph of interest (Figure 1 in the attachment) and the graph you drew?&lt;/P&gt;&lt;P&gt;1)How would you going to fix the problem of deciles being on the vertical axis instead of the horizontal axis;&lt;/P&gt;&lt;P&gt;2)How exactly would you implement the "overlay the SCATTERPLOT / YUPPERLIMIT= YLOWERLIMIT= statement with a LOESS curve".&lt;/P&gt;&lt;P&gt;I understand that these codes may be super easy to you, but they are actually&amp;nbsp;the&amp;nbsp;bottleneck for me for this question. I googled for one day&amp;nbsp;and found nothing. Thank you!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 01:17:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/334235#M11636</guid>
      <dc:creator>bioning</dc:creator>
      <dc:date>2017-02-20T01:17:56Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting Calibration curve/line</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/334326#M11637</link>
      <description>&lt;P&gt;If you post sample data, we can make concrete suggestions. But it sounds like you want something like the following. Here I am using PROC SGPLOT, which has a simple syntax:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Have;
input decile y low hi;
datalines;
1 1 0 2
2 3 1 2
3 4 2 5
4 6 4 7
5 5.5 5 6
6 5 4 6
7 4.5 4 7
8 3 1 5
9 2 1 3
;
proc sgplot data=Have;
scatter x=decile y=Y / YErrorLower=low YErrorUpper=hi;
loess x=decile y=y;
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 13:18:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/334326#M11637</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-02-20T13:18:45Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting Calibration curve/line</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/334385#M11640</link>
      <description>&lt;P&gt;Dear Rick:&lt;/P&gt;&lt;P&gt;Thank you so much for the instructions!&lt;/P&gt;&lt;P&gt;Now I'm just one step away from the figure in that article. Below are&amp;nbsp;the codes I learned from you and applied to this question. The dataset was attached in the attachment. The variable phat_mean is the predicted risk by group, and the ob_risk is the observed risk by group. The 10 groups were divided&amp;nbsp;based on&amp;nbsp;the deciles of the predicted risk. My final question is: how to reproduce that dashed diagonal line, which appears to be a reference line,&amp;nbsp;in Figure 1&amp;nbsp;of that article?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sgplot data=ning;&lt;BR /&gt;scatter x=phat_mean y=ob_risk / YErrorLower=Lower_CI YErrorUpper=Upper_CI;&lt;BR /&gt;loess x=phat_mean y=ob_risk;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looking forward to your further instruction!&lt;/P&gt;&lt;P&gt;Many thanks!&lt;/P&gt;&lt;P&gt;Ning&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 17:03:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/334385#M11640</guid>
      <dc:creator>bioning</dc:creator>
      <dc:date>2017-02-20T17:03:04Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting Calibration curve/line</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/334404#M11641</link>
      <description>&lt;P&gt;Glad you are making progress. &amp;nbsp;I suggest you also add the NOMARKERS option to the LOESS statement. Then use the LINEPARM statement, like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=ning;
scatter x=phat_mean y=ob_risk / YErrorLower=Lower_CI YErrorUpper=Upper_CI;
loess x=phat_mean y=ob_risk / nomarkers;
lineparm x=0 y=0 slope=1 / lineattrs=(pattern=dashed);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 18:01:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/334404#M11641</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-02-20T18:01:05Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting Calibration curve/line</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/334508#M11646</link>
      <description>&lt;P&gt;Dear Rick:&lt;/P&gt;&lt;P&gt;Thank you for your tremendous help!&lt;/P&gt;&lt;P&gt;This "calibration plot" is an question&amp;nbsp;in&amp;nbsp;my assignment of a&amp;nbsp;master-degree&amp;nbsp;university course. To the best of my knowledge, your solution is the only, and&amp;nbsp;THE BEST,&amp;nbsp;resource that is available online as of now. In my homework, I cited your instructions&amp;nbsp;and wrote: "The solution and the&amp;nbsp;codes were developed under the guidance of, and virtually by,&amp;nbsp;Mr. Rick from the SAS Institute. Web link listed below.&amp;nbsp;&lt;A href="https://communities.sas.com/t5/forums/replypage/board-id/sas_graph/message-id/11641" target="_blank"&gt;https://communities.sas.com/t5/forums/replypage/board-id/sas_graph/message-id/11641&lt;/A&gt;"&lt;/P&gt;&lt;P&gt;The final graph is enclosed in the attachment for other SAS users' reference. This calibration plot is widely used to illustrate the performance of a "risk prediction model" in the medical land. It compares the predicted risk with the observed risk by level of the predicted risk. Statistically, it is also&amp;nbsp;a visualization of the&amp;nbsp;"Hosmer-Lemeshow test" that examines the&amp;nbsp;extent to which the predicted&amp;nbsp;values produced from the statistical model match the observed values obtained from the real world.&lt;/P&gt;&lt;P&gt;Many thanks again!&lt;/P&gt;&lt;P&gt;Ning&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Feb 2017 23:42:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/334508#M11646</guid>
      <dc:creator>bioning</dc:creator>
      <dc:date>2017-02-20T23:42:39Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting Calibration curve/line</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/480137#M16589</link>
      <description>&lt;P&gt;For future reference, here are two blog posts about calibration curves in SAS:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/iml/2018/05/14/calibration-plots-in-sas.html" target="_self"&gt;Calibration plots in SAS&amp;nbsp;&lt;/A&gt; [using loess curves]&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/iml/2018/05/16/decile-calibration-plots-sas.html" target="_self"&gt;Decile calibration plots in SAS&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The second article includes a&amp;nbsp;comparison of the two methods. It ends with the following recommendation:&lt;/P&gt;
&lt;P&gt;"Many leading researchers in logistic regression do not recommend the Hosmer-Lemeshow test for these reasons. The decile-based calibration curve shares the same drawbacks. Since SAS can easily create the loess-based calibration curve (see the previous article), there seems to be little reason to prefer the decile-based version."&lt;/P&gt;</description>
      <pubDate>Sat, 21 Jul 2018 11:25:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/480137#M16589</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2018-07-21T11:25:09Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting Calibration curve/line</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/488046#M16774</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you mind posting the entire code from the start please? I don't understand what is phat_mean? Is it the mean of the predicted probability? And what is ob_risk ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Sun, 19 Aug 2018 03:39:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/488046#M16774</guid>
      <dc:creator>rajdesai223</dc:creator>
      <dc:date>2018-08-19T03:39:46Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting Calibration curve/line</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/488056#M16778</link>
      <description>&lt;P&gt;The two blog posts that I linked to have complete code for analyzing a simulated data set.&lt;/P&gt;</description>
      <pubDate>Sun, 19 Aug 2018 10:34:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/488056#M16778</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2018-08-19T10:34:02Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting Calibration curve/line</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/488066#M16779</link>
      <description>&lt;P&gt;Hi Rick,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a binary outcome variable called adherence(codes as 0 and 1). I ran the codes you suggested.&lt;/P&gt;&lt;P&gt;Here is my code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc logistic data=cases plots=effect;&lt;BR /&gt;class sex1 race group age1 hmo ER FmsScore;&lt;BR /&gt;model adherence(event="0")=sex1 race group age1 hmo ER FmsScore;&lt;BR /&gt;output out=LogiOut predicted=PredProb; /* save predicted probabilities in data set */&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc rank data=LogiOut out=LogiDecile groups=10;&lt;BR /&gt;var PredProb;&lt;BR /&gt;ranks Decile;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;/* Then compute the mean predicted prob and the empirical proportions (and CI) for each decile */&lt;BR /&gt;proc means data=LogiDecile noprint;&lt;BR /&gt;class Decile;&lt;BR /&gt;types Decile;&lt;BR /&gt;var adherence PredProb;&lt;BR /&gt;output out=file mean=obs_risk PredProbMean&lt;BR /&gt;lclm=Lower_CI uclm=Upper_CI;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sgplot data=file noautolegend aspect=1;&lt;BR /&gt;lineparm x=0 y=0 slope=1 / lineattrs=(color=grey pattern=dash);&lt;BR /&gt;loess x=&lt;SPAN&gt;PredProbMean&lt;/SPAN&gt; y=obs_risk; /* if you want a smoother based on deciles */&lt;BR /&gt;scatter x=&lt;SPAN&gt;PredProbMean&lt;/SPAN&gt; y=ob_risk / yerrorlower=Lower_CI yerrorupper=Upper_CI;&lt;BR /&gt;yaxis label="Observed Probability of Outcome";&lt;BR /&gt;xaxis label="Predicted Probability of Outcome";&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here are the issues I am facing(I have attached a csv file for you)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) There are unequal number of observations in each decile&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) my observed risk and predicted risk are very different in each group because of which I am not getting the plot correct.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank You again.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Aug 2018 15:09:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/488066#M16779</guid>
      <dc:creator>rajdesai223</dc:creator>
      <dc:date>2018-08-19T15:09:03Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting Calibration curve/line</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/488074#M16781</link>
      <description>&lt;P&gt;The main issue is that you are modeling&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;adherence(event="0")&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;whereas in my blog I model&amp;nbsp;adherence(event="1").&amp;nbsp;Thus your&amp;nbsp;graph does not fall along the line y=x.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;That's not an important concern. You can either model&amp;nbsp;adherence(event="1") or you can change the LINEPARM&amp;nbsp;statement to conform to the situation that you have, as follows. (Note that I changed some variable names to conform to the names in your CVS file.):&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=A noautolegend aspect=1;
   lineparm x=0 y=1 slope=-1 / lineattrs=(color=grey pattern=dash) clip;
   loess x=PredProbMean y=obs_risk;
   scatter x=PredProbMean y=obs_risk / yerrorlower=yLower yerrorupper=yUpper;
   yaxis label="Observed Probability of Outcome";
   xaxis label="Predicted Probability of Outcome";
run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 19 Aug 2018 18:43:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/488074#M16781</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2018-08-19T18:43:30Z</dc:date>
    </item>
    <item>
      <title>Re: Plotting Calibration curve/line</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/488193#M16782</link>
      <description>&lt;P&gt;Thank You Rick. This was very helpful.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Aug 2018 13:37:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Plotting-Calibration-curve-line/m-p/488193#M16782</guid>
      <dc:creator>rajdesai223</dc:creator>
      <dc:date>2018-08-20T13:37:46Z</dc:date>
    </item>
  </channel>
</rss>

