<?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: Maximum Likelihood Estimation: NLP/ NLMIXED/ IML in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Maximum-Likelihood-Estimation-NLP-NLMIXED-IML/m-p/148494#M1277</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I suspect that the error also occurs for PROC NLMIXED, but that the procedure just silently continues, whereas PROC IML is stopping after it records 1000 instances of the error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Obviously I don't know your problem as well as you do, but shouldn't u1 be constrained to be positive, the way u2 and v are?&lt;/P&gt;&lt;P&gt;The error is that xb has negative values and so in the Box-Cox transformation the expression xb##u1 is not mathematically valid when u1&amp;lt;0. If you don't contrain u1, then you need to modify the BC function so that it can handle negative values for the local variable y.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 19 Mar 2014 14:21:41 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2014-03-19T14:21:41Z</dc:date>
    <item>
      <title>Maximum Likelihood Estimation: NLP/ NLMIXED/ IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Maximum-Likelihood-Estimation-NLP-NLMIXED-IML/m-p/148491#M1274</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am running the same simulation in SAS/IML and NLMIXED to estimate model parameters for a specified log-likelihood function. While NLMIXED runs without issues, SAS/IML some times stops in error. Can any state/list the main differences between NLP/NLMIXED/IML in finding MLE? Ordinarily, I would assume there are none but there must be some differences that would cause SAS/IML to stop but NLMIXED to run without error or warning. For security reasons I am not at liberty to post the code. However, I am hoping a general discussion may help to answer this question. I would really prefer to use SAS/IML as it is easier to code in a matrix language.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raphael &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Mar 2014 06:14:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Maximum-Likelihood-Estimation-NLP-NLMIXED-IML/m-p/148491#M1274</guid>
      <dc:creator>R_Fraser</dc:creator>
      <dc:date>2014-03-19T06:14:25Z</dc:date>
    </item>
    <item>
      <title>Re: Maximum Likelihood Estimation: NLP/ NLMIXED/ IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Maximum-Likelihood-Estimation-NLP-NLMIXED-IML/m-p/148492#M1275</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When IML "stops in in error," what does the Log say is the cause of the error?&amp;nbsp; Also, what NLP algorithm are you using for IML and what algorithm and options are you using for NLMIXED?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Mar 2014 12:35:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Maximum-Likelihood-Estimation-NLP-NLMIXED-IML/m-p/148492#M1275</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2014-03-19T12:35:15Z</dc:date>
    </item>
    <item>
      <title>Re: Maximum Likelihood Estimation: NLP/ NLMIXED/ IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Maximum-Likelihood-Estimation-NLP-NLMIXED-IML/m-p/148493#M1276</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is a snippet of the code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know why the error occurs but why not in NLMIXED also. I don't want to constrain my coefficients. How to solve this issue?&lt;/P&gt;&lt;P&gt;SAS/IML error&lt;/P&gt;&lt;P&gt;WARNING: Invalid argument resulted in missing value result.&lt;/P&gt;&lt;P&gt; count&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; : number of occurrences is 1000&lt;/P&gt;&lt;P&gt; operation : ## at line 1295 column 5&lt;/P&gt;&lt;P&gt; operands&amp;nbsp; : y, u&lt;/P&gt;&lt;P&gt;y&amp;nbsp;&amp;nbsp; 1000 rows&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 col&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (numeric)&lt;/P&gt;&lt;P&gt;u&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 row&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 col&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (numeric)&lt;/P&gt;&lt;P&gt; -0.180567&lt;/P&gt;&lt;P&gt; statement : ASSIGN at line 1295 column 5&lt;/P&gt;&lt;P&gt; traceback : module BC at line 1295 column 5&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; module OBJFUN at line 1322 column 5&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Box-Cox transformation */&lt;/P&gt;&lt;P&gt;start BC(y,u);&lt;/P&gt;&lt;P&gt;&amp;nbsp; f = (y##u - 1)/u;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* &amp;lt;-- line 1295 */&lt;/P&gt;&lt;P&gt;&amp;nbsp; return(f);&lt;/P&gt;&lt;P&gt;finish BC;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Bickle-Doksum transformation */&lt;/P&gt;&lt;P&gt;start BD(y,u);&lt;/P&gt;&lt;P&gt;&amp;nbsp; f = (sign(y)#abs(y)##u - 1)/u;&lt;/P&gt;&lt;P&gt;&amp;nbsp; return(f);&lt;/P&gt;&lt;P&gt;finish BD;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* log-likelihood */&lt;/P&gt;&lt;P&gt;start OBJFUN(parm) global(yy, xx);&lt;/P&gt;&lt;P&gt;&amp;nbsp; b = parm[1:2]; &lt;/P&gt;&lt;P&gt;&amp;nbsp; u1 = parm[3];&lt;/P&gt;&lt;P&gt;&amp;nbsp; u2 = parm[4];&lt;/P&gt;&lt;P&gt;&amp;nbsp; v = parm[5];&lt;/P&gt;&lt;P&gt;&amp;nbsp; xb = xx*b;&lt;/P&gt;&lt;P&gt;&amp;nbsp; w = BD(BC(yy,u1),u2); &lt;/P&gt;&lt;P&gt;&amp;nbsp; mu = BD(BC(xb,u1),u2);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* &amp;lt;-- line 1322 */&lt;/P&gt;&lt;P&gt;&amp;nbsp; n = nrow(yy);&lt;/P&gt;&lt;P&gt;&amp;nbsp; f = -n/2*log(v) - 1/2/v*sum((w-mu)##2) + (u2-1)*sum(log(abs(BC(yy,u1)))) + u1*sum(log(yy));&lt;/P&gt;&lt;P&gt;&amp;nbsp; return (f);&lt;/P&gt;&lt;P&gt;finish OBJFUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt; xx = xx || J(nrow(xx),1); /* add intercept term */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* b1-b0-u1-u2-v constraint matrix */&lt;/P&gt;&lt;P&gt;&amp;nbsp; con = { .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; 1e-6&amp;nbsp; 1e-6,&amp;nbsp;&amp;nbsp; /* lower bounds */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .&amp;nbsp; .}; /* upper bounds */&lt;/P&gt;&lt;P&gt;&amp;nbsp; x0 = {1 6.5 0.1 1 1}; /* starting values */&lt;/P&gt;&lt;P&gt;&amp;nbsp; opt = {1 0};&amp;nbsp;&amp;nbsp; /* maximization - supress results */&lt;/P&gt;&lt;P&gt;&amp;nbsp; call nlpnra(rc, mle, "OBJFUN", x0, opt, con);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PROC NLMIXED&lt;/P&gt;&lt;P&gt;proc nlmixed data = sample tech = NEWRAP maxit = 1000;&lt;/P&gt;&lt;P&gt; parms b1 = 6.5 b2 = 1 v = 1 u1= 0.1 u2= 1 ; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;xb = b1 + b2 * x ;&lt;/P&gt;&lt;P&gt; y0 = (&amp;nbsp; y ** u1 - 1 )/u1 ;&lt;/P&gt;&lt;P&gt; xb0 = (&amp;nbsp; xb ** u1 - 1 )/u1 ;&lt;/P&gt;&lt;P&gt; y_ = (sign(y0)*abs(y0)**u2-1)/u2 ;&lt;/P&gt;&lt;P&gt; xb_ = (sign(xb0)*abs(xb0)**u2-1)/u2 ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; llik = ( -1/2*log(v) - 1/2/v*( y_ - xb_)**2 + &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;(u2 - 1)*log((abs(y0)) +&amp;nbsp; u1*log(y);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; model zzz ~ general(llik);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Mar 2014 13:13:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Maximum-Likelihood-Estimation-NLP-NLMIXED-IML/m-p/148493#M1276</guid>
      <dc:creator>R_Fraser</dc:creator>
      <dc:date>2014-03-19T13:13:55Z</dc:date>
    </item>
    <item>
      <title>Re: Maximum Likelihood Estimation: NLP/ NLMIXED/ IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Maximum-Likelihood-Estimation-NLP-NLMIXED-IML/m-p/148494#M1277</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I suspect that the error also occurs for PROC NLMIXED, but that the procedure just silently continues, whereas PROC IML is stopping after it records 1000 instances of the error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Obviously I don't know your problem as well as you do, but shouldn't u1 be constrained to be positive, the way u2 and v are?&lt;/P&gt;&lt;P&gt;The error is that xb has negative values and so in the Box-Cox transformation the expression xb##u1 is not mathematically valid when u1&amp;lt;0. If you don't contrain u1, then you need to modify the BC function so that it can handle negative values for the local variable y.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Mar 2014 14:21:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Maximum-Likelihood-Estimation-NLP-NLMIXED-IML/m-p/148494#M1277</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2014-03-19T14:21:41Z</dc:date>
    </item>
    <item>
      <title>Re: Maximum Likelihood Estimation: NLP/ NLMIXED/ IML</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Maximum-Likelihood-Estimation-NLP-NLMIXED-IML/m-p/148495#M1278</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Modifying the BC function to handle negative values is the approach I took. Since putting a constraint on u1&amp;gt;0 limits the type of transformations we have available. However, I soon realize that this approach has drawbacks as this is a transform both sides model. Meaning we must apply &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;the same transformation to both the response and the regression function to preserve the relationship.&lt;/SPAN&gt; I began with wanting to simultaneously estimate c , u1 and u2. That is, &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;mu = BD(BC(xb + c,u1),u2)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;It turns out that applying the two-parameter Box-Cox transformation to the transform-both-sides (TBS) regression model is not straight forward. The main reason being that the constraint min(xb) + c &amp;gt; 0 is data dependent. This in it self is not an issue until you realize that at each iteration of the algorithm the coefficients can take on&lt;/P&gt;&lt;P&gt;positive as well as negative values. Hence I see no way to specify the constraint min(xb) + c &amp;gt; 0 since the sign of xb may change at each iteration.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It does seem easier to fix c &amp;gt; -min(x) then estimate u1 and u2. &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;As you rightly suggested some time ago in another discussion, we can fix c such that c &amp;gt; - min(xb). It is well known that as c moves away from - min(xb) the transformation becomes less effective. &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Mar 2014 18:25:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Maximum-Likelihood-Estimation-NLP-NLMIXED-IML/m-p/148495#M1278</guid>
      <dc:creator>R_Fraser</dc:creator>
      <dc:date>2014-03-19T18:25:01Z</dc:date>
    </item>
  </channel>
</rss>

