<?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: not the correct expected proportion in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/not-the-correct-expected-proportion/m-p/980171#M49117</link>
    <description>&lt;P&gt;Where are the sizes&amp;nbsp;13034 321 338 77 80 151 109 86 73 36&amp;nbsp;coming from?&amp;nbsp; &amp;nbsp;&lt;BR /&gt;The doc discusses how to get the observed and expected numbers for the groups in the H-L test.&lt;BR /&gt;Please run your model as&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc logistic data=noduleData;
model GT_finding(event='1')= report_score/ lackfit (DF=8 NGROUPS=10) ;
ods select  LackFitPartition;
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and upload the LackFitPartition table for your data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 04 Dec 2025 21:23:56 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2025-12-04T21:23:56Z</dc:date>
    <item>
      <title>not the correct expected proportion</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/not-the-correct-expected-proportion/m-p/979992#M49112</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am trying to calculate the Hosmer-Lemeshow p-value using proc logistic with lackfit option but the expected proportion given by SAS are not mine. How to put the expected proportion in the model?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please find my code:&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc logistic data=noduleData;&lt;BR /&gt;model GT_finding(event='1')= report_score/ lackfit (DF=8 NGROUPS=13034 321 338 77 80 151 109 86 73 36 ) ;&lt;BR /&gt;run;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 04 Dec 2025 07:26:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/not-the-correct-expected-proportion/m-p/979992#M49112</guid>
      <dc:creator>PSIOT2</dc:creator>
      <dc:date>2025-12-04T07:26:21Z</dc:date>
    </item>
    <item>
      <title>Re: not the correct expected proportion</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/not-the-correct-expected-proportion/m-p/980009#M49113</link>
      <description>&lt;P&gt;Could you explain your issue more clear ?&lt;/P&gt;
&lt;P&gt;According to the Documentation:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1764840893485.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/111782i25286FA3B3AD4FD1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1764840893485.png" alt="Ksharp_0-1764840893485.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So you could check the output of logistic model is right or not.&lt;/P&gt;
&lt;P&gt;Code something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc logistic data=sashelp.heart(obs=1000 where=(height is not missing));
model status(EVENT='Dead')=height /lackfit(DF=8 NGROUPS=10) ;
output out=want p=pred;  *save predicted Prob for dividing groups in Hosmer-Lemeshow test;
run;



/********Check the expected proportion is matched or not*************/
proc rank data=want out=want2 groups=10 ;
var pred;
ranks groups;
run;
proc sql;
select groups,count(*) as count,sum(Status = 'Dead' ) as Status_Dead_Obs,sum(pred) as Expected
from want2
 group by groups;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here I take&amp;nbsp;Status = 'Dead' as an example . and get the correct expected proportion.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_1-1764841041604.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/111783i9ED3F529C883128A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_1-1764841041604.png" alt="Ksharp_1-1764841041604.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_2-1764841260857.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/111785iF253C1D365FA064C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_2-1764841260857.png" alt="Ksharp_2-1764841260857.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here I think the most different thing is how to split these data into groups . Check the Doc ,see H-L how to group these data, once you know the details of H-L, I believe you would get the matched result.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Dec 2025 09:43:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/not-the-correct-expected-proportion/m-p/980009#M49113</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-12-04T09:43:24Z</dc:date>
    </item>
    <item>
      <title>Re: not the correct expected proportion</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/not-the-correct-expected-proportion/m-p/980012#M49114</link>
      <description>&lt;P&gt;Thank for your answers.&lt;/P&gt;&lt;P&gt;I have 10 groups with proportion expected = 0.0003, 0.01, 0.02, 0.06, 0.18, 0.29, 0.39, 0.71, 0.89, 0.93.&lt;/P&gt;&lt;P&gt;The number of cases in each groups are different too:&amp;nbsp;13034, 321, 338, 77, 80, 151, 109, 86, 73, 36.&lt;/P&gt;&lt;P&gt;It seems that it is not possible to precise to enter the expected proportions in logistic model.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Dec 2025 09:53:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/not-the-correct-expected-proportion/m-p/980012#M49114</guid>
      <dc:creator>PSIOT2</dc:creator>
      <dc:date>2025-12-04T09:53:55Z</dc:date>
    </item>
    <item>
      <title>Re: not the correct expected proportion</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/not-the-correct-expected-proportion/m-p/980171#M49117</link>
      <description>&lt;P&gt;Where are the sizes&amp;nbsp;13034 321 338 77 80 151 109 86 73 36&amp;nbsp;coming from?&amp;nbsp; &amp;nbsp;&lt;BR /&gt;The doc discusses how to get the observed and expected numbers for the groups in the H-L test.&lt;BR /&gt;Please run your model as&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc logistic data=noduleData;
model GT_finding(event='1')= report_score/ lackfit (DF=8 NGROUPS=10) ;
ods select  LackFitPartition;
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and upload the LackFitPartition table for your data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Dec 2025 21:23:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/not-the-correct-expected-proportion/m-p/980171#M49117</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2025-12-04T21:23:56Z</dc:date>
    </item>
    <item>
      <title>Re: not the correct expected proportion</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/not-the-correct-expected-proportion/m-p/980240#M49122</link>
      <description>I think Rick is right. &lt;BR /&gt;According to Doc ,the group number is balance(a.k.a has almost the same number in each group), you can not get unbalance group .&lt;BR /&gt;Check the Doc again.</description>
      <pubDate>Sat, 06 Dec 2025 12:20:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/not-the-correct-expected-proportion/m-p/980240#M49122</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-12-06T12:20:14Z</dc:date>
    </item>
    <item>
      <title>Re: not the correct expected proportion</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/not-the-correct-expected-proportion/m-p/980378#M49124</link>
      <description>&lt;P&gt;Please find the LackFitPartition:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="PSIOT2_0-1765198375899.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112020iC2A4A80F4BFD860A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="PSIOT2_0-1765198375899.png" alt="PSIOT2_0-1765198375899.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Dec 2025 12:53:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/not-the-correct-expected-proportion/m-p/980378#M49124</guid>
      <dc:creator>PSIOT2</dc:creator>
      <dc:date>2025-12-08T12:53:06Z</dc:date>
    </item>
    <item>
      <title>Re: not the correct expected proportion</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/not-the-correct-expected-proportion/m-p/980379#M49125</link>
      <description>You have extreme unbalance data:&lt;BR /&gt;367: 13938 =0.026&lt;BR /&gt;a.k.a the probability of event is too small.&lt;BR /&gt;Logistic model is unsuited(not right) for this data.&lt;BR /&gt;You need to oversample data to make this ratio is about 0.1, 0.2 ,0.3 .... and use PROC LOGISTIC again.&lt;BR /&gt;Or try other model like : Decision Tree, Random Forest .</description>
      <pubDate>Mon, 08 Dec 2025 13:03:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/not-the-correct-expected-proportion/m-p/980379#M49125</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-12-08T13:03:30Z</dc:date>
    </item>
    <item>
      <title>Re: not the correct expected proportion</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/not-the-correct-expected-proportion/m-p/980516#M49133</link>
      <description>Here is the issue I am talking about.&lt;BR /&gt;&lt;A href="https://support.sas.com/kb/22/601.html" target="_blank"&gt;https://support.sas.com/kb/22/601.html&lt;/A&gt;</description>
      <pubDate>Wed, 10 Dec 2025 05:47:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/not-the-correct-expected-proportion/m-p/980516#M49133</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2025-12-10T05:47:11Z</dc:date>
    </item>
    <item>
      <title>Re: not the correct expected proportion</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/not-the-correct-expected-proportion/m-p/980524#M49134</link>
      <description>&lt;P&gt;Thank you, proc logistic is not appropriate with this dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Dec 2025 07:41:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/not-the-correct-expected-proportion/m-p/980524#M49134</guid>
      <dc:creator>PSIOT2</dc:creator>
      <dc:date>2025-12-10T07:41:38Z</dc:date>
    </item>
  </channel>
</rss>

