<?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 Calculating Model fit in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Calculating-Model-fit/m-p/854954#M337927</link>
    <description>&lt;P&gt;Hello Community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to calculate model fit for a full and reduced model with the code below using the loglikelihood ratio generated from Proc glimx.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%let numParmsFull = 4;&lt;BR /&gt;%let numParmsReduced = 3;&lt;BR /&gt;%let LLfull = 4206.91&lt;BR /&gt;%let LLreduced = 4088.56
&lt;BR /&gt;data _null_;
set FitStatistics;
if Model='Full' then call symput('LLfull',value);
if Model='Reduced' then call symput('LLreduced',value);
run;&lt;BR /&gt;
data _null_;
df=&amp;amp;numParmsFull-&amp;amp;numParmsReduced; 
/* numParmsFull and numParmsReduced should be the number of parameters in the full and reduced models respectively */
testStat = &amp;amp;LLfull - &amp;amp;LLreduced;
pvalue = 1 - probchisq(testStat,df);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;When i run the code i get this&amp;nbsp; ERROR&amp;nbsp; The function PROBCHISQ is unknown, or cannot be accessed.&lt;BR /&gt;&lt;BR /&gt;Also, can you also help to determine model fit for two model using other method?&lt;BR /&gt;&lt;BR /&gt;Can anyone help with how i can get the p-value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Timothy&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 21 Jan 2023 10:13:28 GMT</pubDate>
    <dc:creator>timothy19</dc:creator>
    <dc:date>2023-01-21T10:13:28Z</dc:date>
    <item>
      <title>Calculating Model fit</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-Model-fit/m-p/854954#M337927</link>
      <description>&lt;P&gt;Hello Community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to calculate model fit for a full and reduced model with the code below using the loglikelihood ratio generated from Proc glimx.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%let numParmsFull = 4;&lt;BR /&gt;%let numParmsReduced = 3;&lt;BR /&gt;%let LLfull = 4206.91&lt;BR /&gt;%let LLreduced = 4088.56
&lt;BR /&gt;data _null_;
set FitStatistics;
if Model='Full' then call symput('LLfull',value);
if Model='Reduced' then call symput('LLreduced',value);
run;&lt;BR /&gt;
data _null_;
df=&amp;amp;numParmsFull-&amp;amp;numParmsReduced; 
/* numParmsFull and numParmsReduced should be the number of parameters in the full and reduced models respectively */
testStat = &amp;amp;LLfull - &amp;amp;LLreduced;
pvalue = 1 - probchisq(testStat,df);
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;When i run the code i get this&amp;nbsp; ERROR&amp;nbsp; The function PROBCHISQ is unknown, or cannot be accessed.&lt;BR /&gt;&lt;BR /&gt;Also, can you also help to determine model fit for two model using other method?&lt;BR /&gt;&lt;BR /&gt;Can anyone help with how i can get the p-value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Timothy&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 21 Jan 2023 10:13:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-Model-fit/m-p/854954#M337927</guid>
      <dc:creator>timothy19</dc:creator>
      <dc:date>2023-01-21T10:13:28Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Model fit</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-Model-fit/m-p/854964#M337929</link>
      <description>&lt;P&gt;The function that computes the probability from a chi-square distribution is called PROBCHI, so use&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;pvalue = 1 - probchi(testStat,df);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In general, I avoid the PROB* functions and use the CDF function instead. So I would use&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;pvalue = 1 - cdf("chisq", testStat, df);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or you could use the SDF (survival) function, which has the computation "1 minus CDF" built in:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;pvalue = sdf("chisq", testStat, df);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 21 Jan 2023 12:11:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-Model-fit/m-p/854964#M337929</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2023-01-21T12:11:00Z</dc:date>
    </item>
    <item>
      <title>Re: Calculating Model fit</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculating-Model-fit/m-p/854978#M337934</link>
      <description>&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Sat, 21 Jan 2023 19:43:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculating-Model-fit/m-p/854978#M337934</guid>
      <dc:creator>timothy19</dc:creator>
      <dc:date>2023-01-21T19:43:44Z</dc:date>
    </item>
  </channel>
</rss>

