<?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 PROC NLMIXED AND TRUNCATED POISSON in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-NLMIXED-AND-TRUNCATED-POISSON/m-p/10187#M120</link>
    <description>Hi Guys: I am trying to code a random effects model in PROC NLMIXED using the truncated poisson likelihood. I assume that the form of the likelihood for my data whichs has a fixed upper value is:&lt;BR /&gt;
Pr(X=x) /Pr(X&amp;lt; =x)&lt;BR /&gt;
&lt;BR /&gt;
So the numerator part of this likelihood is just the poisson likelihood but the denominator part is Sum(i=1..K ,Pr(X=k)) which is just the cumulative poisson but only upto a finite k. My code is as follows:&lt;BR /&gt;
&lt;BR /&gt;
********************************************************************************************&lt;BR /&gt;
&lt;BR /&gt;
proc nlmixed data=reuse(where=(reuse_n&amp;gt;=0)) DS=5 qpoints=1;&lt;BR /&gt;
&lt;BR /&gt;
v11 = a11*a11;&lt;BR /&gt;
v12 = a11*a12;&lt;BR /&gt;
v22 = a12*a12 + a22*a22;&lt;BR /&gt;
&lt;BR /&gt;
mu = exp(br0 + br1*time + br2*flux + br3*time*flux + u0 + u1*time);&lt;BR /&gt;
lr=-mu + reuse_n * log(mu) - log(fact(reuse_n))-poisson(20,mu);      &lt;BR /&gt;
model reuse_n ~ general(lr);&lt;BR /&gt;
random u0 u1 ~ normal([0, 0],[v11,v12,v22]) subject=id;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
********************************************************************************************&lt;BR /&gt;
&lt;BR /&gt;
I am assuming that if my data is truncated at k=20 then the cumulative part of the likelihood is poisson(20,mu). I tried this and it does not run and gives me the following error messages:&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
NOTE: The parameters br0, br1, br2, br3 are assigned the default starting value of 1.0, because they are not assigned initial values with the PARMS statement.&lt;BR /&gt;
NOTE: A finite difference approximation is used for the derivative of the POISSON function at line 77 column 40.&lt;BR /&gt;
NOTE: Execution error for observation 1.&lt;BR /&gt;
&lt;BR /&gt;
If anyone could help me with this issue I would be extremely grateful. I have seen a PROC NLMIXED example where the users uses the probnorm statment and that runs fine so I assumed that SAS knows how to take the derivative of the poisson cdf.&lt;BR /&gt;
&lt;BR /&gt;
Thanks Guys</description>
    <pubDate>Sun, 01 Nov 2009 03:06:02 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-11-01T03:06:02Z</dc:date>
    <item>
      <title>PROC NLMIXED AND TRUNCATED POISSON</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-NLMIXED-AND-TRUNCATED-POISSON/m-p/10187#M120</link>
      <description>Hi Guys: I am trying to code a random effects model in PROC NLMIXED using the truncated poisson likelihood. I assume that the form of the likelihood for my data whichs has a fixed upper value is:&lt;BR /&gt;
Pr(X=x) /Pr(X&amp;lt; =x)&lt;BR /&gt;
&lt;BR /&gt;
So the numerator part of this likelihood is just the poisson likelihood but the denominator part is Sum(i=1..K ,Pr(X=k)) which is just the cumulative poisson but only upto a finite k. My code is as follows:&lt;BR /&gt;
&lt;BR /&gt;
********************************************************************************************&lt;BR /&gt;
&lt;BR /&gt;
proc nlmixed data=reuse(where=(reuse_n&amp;gt;=0)) DS=5 qpoints=1;&lt;BR /&gt;
&lt;BR /&gt;
v11 = a11*a11;&lt;BR /&gt;
v12 = a11*a12;&lt;BR /&gt;
v22 = a12*a12 + a22*a22;&lt;BR /&gt;
&lt;BR /&gt;
mu = exp(br0 + br1*time + br2*flux + br3*time*flux + u0 + u1*time);&lt;BR /&gt;
lr=-mu + reuse_n * log(mu) - log(fact(reuse_n))-poisson(20,mu);      &lt;BR /&gt;
model reuse_n ~ general(lr);&lt;BR /&gt;
random u0 u1 ~ normal([0, 0],[v11,v12,v22]) subject=id;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
********************************************************************************************&lt;BR /&gt;
&lt;BR /&gt;
I am assuming that if my data is truncated at k=20 then the cumulative part of the likelihood is poisson(20,mu). I tried this and it does not run and gives me the following error messages:&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
NOTE: The parameters br0, br1, br2, br3 are assigned the default starting value of 1.0, because they are not assigned initial values with the PARMS statement.&lt;BR /&gt;
NOTE: A finite difference approximation is used for the derivative of the POISSON function at line 77 column 40.&lt;BR /&gt;
NOTE: Execution error for observation 1.&lt;BR /&gt;
&lt;BR /&gt;
If anyone could help me with this issue I would be extremely grateful. I have seen a PROC NLMIXED example where the users uses the probnorm statment and that runs fine so I assumed that SAS knows how to take the derivative of the poisson cdf.&lt;BR /&gt;
&lt;BR /&gt;
Thanks Guys</description>
      <pubDate>Sun, 01 Nov 2009 03:06:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-NLMIXED-AND-TRUNCATED-POISSON/m-p/10187#M120</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-11-01T03:06:02Z</dc:date>
    </item>
    <item>
      <title>Re: PROC NLMIXED AND TRUNCATED POISSON</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/PROC-NLMIXED-AND-TRUNCATED-POISSON/m-p/10188#M121</link>
      <description>proc sort by id; before running the model.&lt;BR /&gt;
&lt;BR /&gt;
Kui</description>
      <pubDate>Mon, 04 Oct 2010 22:56:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/PROC-NLMIXED-AND-TRUNCATED-POISSON/m-p/10188#M121</guid>
      <dc:creator>Kui</dc:creator>
      <dc:date>2010-10-04T22:56:23Z</dc:date>
    </item>
  </channel>
</rss>

