<?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: PROC GENMOD Error in computing inverse link function in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-GENMOD-Error-in-computing-inverse-link-function/m-p/867045#M42852</link>
    <description>The inverse link function for this model is exponentiation and is applied to X*beta to estimate the Poisson mean, where beta is the vector of parameter estimates at the given maximum likelihood iteration. Probably at some iteration and for some observation, X*beta becomes large enough that exp(x*beta) cannot be computed. And as noted in the log for this model, there are non-integer values in the response variable, AMOUNT. While the maximum likelihood estimation can still be done in this case, the Poisson distribution is a discrete distribution and should have only integer values. If AMOUNT is a continuous variable, you should probably consider a more appropriate distribution - possibly the gamma or inverse gaussian distribution if the response is strictly positive and skewed.</description>
    <pubDate>Wed, 29 Mar 2023 15:07:27 GMT</pubDate>
    <dc:creator>StatDave</dc:creator>
    <dc:date>2023-03-29T15:07:27Z</dc:date>
    <item>
      <title>PROC GENMOD Error in computing inverse link function</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-GENMOD-Error-in-computing-inverse-link-function/m-p/866989#M42843</link>
      <description>&lt;P&gt;I'm trying to run three related models.&amp;nbsp; The first and third converge, but the second doesn't.&amp;nbsp; I expected the second and third model to be the same.&amp;nbsp; My variables 'amount' and 'expamt' are the product of 'count' and 'expct' times 'dollars' (which is always positive and generally in the thousands).&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What's causing the error in the second model?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;1
2    proc genmod data=mydata;
3        class x1-x8;
4        model count = x1-x8 / dist=p offset=expct;
5    run;

NOTE: Algorithm converged.
NOTE: The scale parameter was held fixed.
NOTE: PROCEDURE GENMOD used (Total process time):
      real time           0.21 seconds
      cpu time            0.17 seconds


6
7    proc genmod data=mydata;
8        class x1-x8;
9        model amount = x1-x8 / dist=p offset=expamt;
10   run;

NOTE: Non-integer response values have been detected for the Poisson distribution.
WARNING: The specified model did not converge.
ERROR:  Error in computing inverse link function.
NOTE: The scale parameter was held fixed.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE GENMOD used (Total process time):
      real time           0.08 seconds
      cpu time            0.04 seconds

11


12   proc genmod data=mydata;
13       class x1-x8;
14       freq dollars;
15       model count = x1-x8 / dist=p offset=expct;
16   run;

NOTE: Algorithm converged.
NOTE: The scale parameter was held fixed.
NOTE: PROCEDURE GENMOD used (Total process time):
      real time           0.17 seconds
      cpu time            0.15 seconds

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 13:48:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-GENMOD-Error-in-computing-inverse-link-function/m-p/866989#M42843</guid>
      <dc:creator>mcs</dc:creator>
      <dc:date>2023-03-29T13:48:09Z</dc:date>
    </item>
    <item>
      <title>Re: PROC GENMOD Error in computing inverse link function</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-GENMOD-Error-in-computing-inverse-link-function/m-p/867045#M42852</link>
      <description>The inverse link function for this model is exponentiation and is applied to X*beta to estimate the Poisson mean, where beta is the vector of parameter estimates at the given maximum likelihood iteration. Probably at some iteration and for some observation, X*beta becomes large enough that exp(x*beta) cannot be computed. And as noted in the log for this model, there are non-integer values in the response variable, AMOUNT. While the maximum likelihood estimation can still be done in this case, the Poisson distribution is a discrete distribution and should have only integer values. If AMOUNT is a continuous variable, you should probably consider a more appropriate distribution - possibly the gamma or inverse gaussian distribution if the response is strictly positive and skewed.</description>
      <pubDate>Wed, 29 Mar 2023 15:07:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-GENMOD-Error-in-computing-inverse-link-function/m-p/867045#M42852</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2023-03-29T15:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: PROC GENMOD Error in computing inverse link function</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-GENMOD-Error-in-computing-inverse-link-function/m-p/867048#M42853</link>
      <description>&lt;P&gt;Thanks for the reply.&amp;nbsp; There are no non-integer values in AMOUNT, though there are in EXPAMT.&amp;nbsp; I want to compare the COUNT and AMOUNT models, so I want to use the same link function for both.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I don't understand is why the third model runs and the second doesn't.&amp;nbsp; If I understand correctly, the FREQ keyword in the third model is telling SAS to multiply everything by DOLLARS.&amp;nbsp; Wouldn't that end up with the same value of exp(x*beta)?&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2023 15:21:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-GENMOD-Error-in-computing-inverse-link-function/m-p/867048#M42853</guid>
      <dc:creator>mcs</dc:creator>
      <dc:date>2023-03-29T15:21:41Z</dc:date>
    </item>
    <item>
      <title>Re: PROC GENMOD Error in computing inverse link function</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-GENMOD-Error-in-computing-inverse-link-function/m-p/867064#M42858</link>
      <description>If you check, I think you will find that there are indeed some non-integer values in the AMOUNT variable. The log message indicates that is what is seen in the data. The FREQ statement effectively replicates each observation FLOOR(DOLLARS) times. Internally, the log likelihood contribution of each observation is multiplied by FLOOR(DOLLARS).</description>
      <pubDate>Wed, 29 Mar 2023 16:06:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-GENMOD-Error-in-computing-inverse-link-function/m-p/867064#M42858</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2023-03-29T16:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: PROC GENMOD Error in computing inverse link function</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-GENMOD-Error-in-computing-inverse-link-function/m-p/867089#M42860</link>
      <description>&lt;P&gt;I did check on AMOUNT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;1
2    data check;
3    set mydata end=eof;
4    retain isint;
5    isint = amount - int(amount);
6    if eof then put isint;
7    run;

0
NOTE: There were 12141 observations read from the data set WORK.MYDATA.
NOTE: The data set WORK.CHECK has 12141 observations and 25 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Mar 2023 18:03:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-GENMOD-Error-in-computing-inverse-link-function/m-p/867089#M42860</guid>
      <dc:creator>mcs</dc:creator>
      <dc:date>2023-03-29T18:03:46Z</dc:date>
    </item>
    <item>
      <title>Re: PROC GENMOD Error in computing inverse link function</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-GENMOD-Error-in-computing-inverse-link-function/m-p/867094#M42864</link>
      <description>&lt;P&gt;That code only shows whether the last observation is non-integer. Try this:&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data nonint; 
  set mydata end=eof; 
  chk=(amount ne int(amount));
  if chk then output;
  nonint+chk; 
  if eof then put "Number nonintegers = " nonint; 
  run;
proc print;
  var y;
  format y 32.16;
  run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Mar 2023 18:16:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-GENMOD-Error-in-computing-inverse-link-function/m-p/867094#M42864</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2023-03-29T18:16:52Z</dc:date>
    </item>
    <item>
      <title>Re: PROC GENMOD Error in computing inverse link function</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-GENMOD-Error-in-computing-inverse-link-function/m-p/867100#M42865</link>
      <description>&lt;P&gt;Thanks again.&amp;nbsp; Below are the first 15 of the "nonintegers".&amp;nbsp; I guess I understand why at least numbers 12 and 15 cause the warning in SAS.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyway, I'm not too worried about the warning if I can avoid it by using the third model in place of the second.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Basically, I want a dollar-weighted model.&amp;nbsp; I thought I could do it by hand (multiplying COUNT by DOLLARS to get AMOUNT), but that didn't work.&amp;nbsp; Instead, using the FREQ keyword seems to work.&amp;nbsp; Is that the right way to do it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Obs amount 
1 3607159.0000000000000000 
2 1360585.0000000000000000 
3 292033.0000000000000000 
4 454095.0000000000000000 
5 1415948.0000000000000000 
6 2668725.0000000000000000 
7 1071775.0000000000000000 
8 223131.0000000000000000 
9 666578.0000000000000000 
10 199082.0000000000000000 
11 1700960.0000000000000000 
12 7458260.9999999900000000 
13 1291928.0000000000000000 
14 3654607.0000000000000000 
15 3798911.9999999900000000 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 29 Mar 2023 18:48:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-GENMOD-Error-in-computing-inverse-link-function/m-p/867100#M42865</guid>
      <dc:creator>mcs</dc:creator>
      <dc:date>2023-03-29T18:48:00Z</dc:date>
    </item>
    <item>
      <title>Re: PROC GENMOD Error in computing inverse link function</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-GENMOD-Error-in-computing-inverse-link-function/m-p/867110#M42866</link>
      <description>It's not clear exactly what you mean by a "dollar-weighted" model, but if you want the Poisson model on the COUNT response to use the values of your DOLLAR variable as weights in the maximum likelihood estimation process (that is, multiply each observation's log likelihood contribution by the non-integerized value of DOLLAR), then just change FREQ DOLLAR; to WEIGHT DOLLAR; . Though you should probably first normalize the DOLLAR weights so that they sum to the sample size to avoid overstating significance.</description>
      <pubDate>Wed, 29 Mar 2023 19:25:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-GENMOD-Error-in-computing-inverse-link-function/m-p/867110#M42866</guid>
      <dc:creator>StatDave</dc:creator>
      <dc:date>2023-03-29T19:25:04Z</dc:date>
    </item>
    <item>
      <title>Re: PROC GENMOD Error in computing inverse link function</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-GENMOD-Error-in-computing-inverse-link-function/m-p/867250#M42878</link>
      <description>&lt;P&gt;I initially thought to use the WEIGHT statement, but I was confused by the documentation, which talks about dividing by the weight instead of multiplying.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;The WEIGHT statement identifies a&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=" aa-argument"&gt;variable&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;in the input data set to be used as the exponential family dispersion parameter weight for each observation. The exponential family dispersion parameter&amp;nbsp;&lt;/SPAN&gt;&lt;A id="statug.genmod.a0000000425" class="indexterm" target="_blank"&gt;&lt;/A&gt;&lt;A id="statug.genmod.a0000000426" class="indexterm" target="_blank"&gt;&lt;/A&gt;&lt;SPAN&gt;is divided by the WEIGHT variable value for each observation.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;HR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2023 13:42:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-GENMOD-Error-in-computing-inverse-link-function/m-p/867250#M42878</guid>
      <dc:creator>mcs</dc:creator>
      <dc:date>2023-03-30T13:42:41Z</dc:date>
    </item>
  </channel>
</rss>

