<?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: how to write the Constraints when one of the parameters depends on the random variable in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-write-the-Constraints-when-one-of-the-parameters-depends/m-p/579188#M4769</link>
    <description>&lt;P&gt;Are you seeing that error when you run EXACTLY the code I posted? Because I do not get that error when I run SAS/IML 15.1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regardless, if you see that message a few times among the 100 simulated samples, it means that the optimization did not converge for certain samples. This can happen if your initial guess is not very good or if you are using very small simulated samples. (I classify N=20 as small for a three-parameter family.) For small simulated samples, you might get "unlucky" and &lt;A href="https://blogs.sas.com/content/iml/2016/11/23/sampling-variation-small-samples.html" target="_self"&gt;the sample does not look very much like a sample from the distribution with the specified parameters.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are two ways to handle the situation.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) Make a better initial guess&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) Report the results of the simulation by saying, "Of the k simulated samples, three did not converge. The results for the remaining samples are shown in Table 3...."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You shouldn't get that error (or not very often) for larger samples like N=100 or more.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 05 Aug 2019 17:08:10 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2019-08-05T17:08:10Z</dc:date>
    <item>
      <title>how to write the Constraints when one of the parameters depends on the random variable</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-write-the-Constraints-when-one-of-the-parameters-depends/m-p/578934#M4758</link>
      <description>&lt;P&gt;Hello ...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to solve a system of nonlinear equations. My problem is with one of the constrains that depends on X. My X is a vector with dimensions n x 1. I looked on the website thinking that I may find something I couldn't. I would really appreciate any guidance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 03 Aug 2019 20:30:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-write-the-Constraints-when-one-of-the-parameters-depends/m-p/578934#M4758</guid>
      <dc:creator>Salah</dc:creator>
      <dc:date>2019-08-03T20:30:38Z</dc:date>
    </item>
    <item>
      <title>Re: how to write the Constraints when one of the parameters depends on the random variable</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-write-the-Constraints-when-one-of-the-parameters-depends/m-p/578935#M4759</link>
      <description>&lt;P&gt;Did you read this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/iml/2018/02/28/solve-system-nonlinear-equations-sas.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2018/02/28/solve-system-nonlinear-equations-sas.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 03 Aug 2019 21:02:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-write-the-Constraints-when-one-of-the-parameters-depends/m-p/578935#M4759</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-08-03T21:02:00Z</dc:date>
    </item>
    <item>
      <title>Re: how to write the Constraints when one of the parameters depends on the random variable</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-write-the-Constraints-when-one-of-the-parameters-depends/m-p/578936#M4760</link>
      <description>&lt;P&gt;Yes I did and from it I learned how to construct the equations. But in the link you provided the constrains are numbers no variables like in my case&lt;/P&gt;</description>
      <pubDate>Sat, 03 Aug 2019 21:38:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-write-the-Constraints-when-one-of-the-parameters-depends/m-p/578936#M4760</guid>
      <dc:creator>Salah</dc:creator>
      <dc:date>2019-08-03T21:38:48Z</dc:date>
    </item>
    <item>
      <title>Re: how to write the Constraints when one of the parameters depends on the random variable</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-write-the-Constraints-when-one-of-the-parameters-depends/m-p/578939#M4761</link>
      <description>&lt;P&gt;One way to do this is to check the condition in the objective function and add a penalty if the condition is violated.&lt;/P&gt;
&lt;P&gt;For example, if you require that X &amp;gt; mu, then compute&amp;nbsp;&lt;/P&gt;
&lt;P&gt;b = ^(X &amp;gt; mu);&amp;nbsp; &amp;nbsp;/* b=1 if condition true */&lt;/P&gt;
&lt;P&gt;penalty = b * 1e6 * (X - mu);&lt;/P&gt;
&lt;P&gt;Then add the penalty to the objective function.&lt;/P&gt;</description>
      <pubDate>Sat, 03 Aug 2019 22:08:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-write-the-Constraints-when-one-of-the-parameters-depends/m-p/578939#M4761</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2019-08-03T22:08:37Z</dc:date>
    </item>
    <item>
      <title>Re: how to write the Constraints when one of the parameters depends on the random variable</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-write-the-Constraints-when-one-of-the-parameters-depends/m-p/578966#M4762</link>
      <description>&lt;P&gt;Hello Rick,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for the reply.&amp;nbsp; Do you mean like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;b = ^(X &amp;gt; mu);&amp;nbsp;&lt;/P&gt;&lt;P&gt;penalty = b * 1e6 * (X - mu);&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;con = {1e-6&amp;nbsp; &amp;nbsp;1e-6&amp;nbsp; &amp;nbsp;-inf,&amp;nbsp; &amp;nbsp;.&amp;nbsp; &amp;nbsp; .&amp;nbsp; &amp;nbsp;penalty };&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But what if X is a vector that doesn't have one value would that still work?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Sun, 04 Aug 2019 05:18:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-write-the-Constraints-when-one-of-the-parameters-depends/m-p/578966#M4762</guid>
      <dc:creator>Salah</dc:creator>
      <dc:date>2019-08-04T05:18:59Z</dc:date>
    </item>
    <item>
      <title>Re: how to write the Constraints when one of the parameters depends on the random variable</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-write-the-Constraints-when-one-of-the-parameters-depends/m-p/578983#M4763</link>
      <description>&lt;P&gt;No. THe BLC matrix is only for linear and boundary&amp;nbsp; constraints on the parameters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Check the condition in the objective function, which you call 'FUN', and return a large value if the current value of mu does not satisfy the condition on X.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now that I look at your implementation, I see that you can't even evaluate the objective function if X &amp;lt; mu, because the objective function has terms like log(X - mu).. What are you trying to do? It sort of looks like a maximum likelihood optimization (sine you simulate X as a sample from the Weibull distribution), but an MLE compuation would use a scalar objective function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a link to some resources:&lt;BR /&gt;- &lt;A href="https://blogs.sas.com/content/iml/2011/10/12/maximum-likelihood-estimation-in-sasiml.html" target="_self"&gt;MLE estimation example in SAS/IML&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://blogs.sas.com/content/iml/2017/06/14/maximum-likelihood-estimates-in-sas.html" target="_self"&gt;- How to use the LOGPDF for common distributions&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;- &lt;A href="https://blogs.sas.com/content/iml/2016/05/11/tips-before-optimization.html" target="_self"&gt;10 tips to follow before you run an optimization&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 04 Aug 2019 10:36:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-write-the-Constraints-when-one-of-the-parameters-depends/m-p/578983#M4763</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2019-08-04T10:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: how to write the Constraints when one of the parameters depends on the random variable</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-write-the-Constraints-when-one-of-the-parameters-depends/m-p/578998#M4764</link>
      <description>&lt;P&gt;Thank you Rick for your help and for your time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My problem is not to find the MLEs. I have 3 equations that I need to solve which I defined in f(1)-f(3). I have to solve other system of equations that are almost have same nature ( X-Mu)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am afraid that I didn't quit understand what you said....I am copying that part of my code below. Kindly ask you to look at it and let me know if what I did is correct and acceptable.&amp;nbsp; Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial black,avant garde"&gt;start fct(var) global (X,n);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial black,avant garde"&gt;Alpha = var[1]; Mu = var[2]; Theta = var[3];&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial black,avant garde"&gt;f = j(1, 3, .);&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial black,avant garde"&gt;sum1=0;sum2=0;sum3=0;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT face="arial black,avant garde"&gt;b=J(n,1,.);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial black,avant garde"&gt;b=X-Mu;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial black,avant garde"&gt;do i=1 to n;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="arial black,avant garde"&gt;if b[i]&amp;lt;=0 then b[i]=0.00001;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial black,avant garde"&gt;if b[i]&amp;gt;0 then b[i]=X[i]-mu;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial black,avant garde"&gt;end;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial black,avant garde"&gt;do j=1 to n;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="arial black,avant garde"&gt;sum1=sum1+log(b[j]);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial black,avant garde"&gt;sum2=sum2+ ( b[j])**Alpha;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial black,avant garde"&gt;sum3=sum3+ log(b[j]) *( b[j] )**Alpha;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial black,avant garde"&gt;end;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial black,avant garde"&gt;f[1] = ( log(theta)+digamma(1.0))/alpha - sum1/n;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial black,avant garde"&gt;f[2] = sum2/n - theta;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial black,avant garde"&gt;f[3] = ( log(theta)+digamma(1.0)+1)/alpha + sum3/(n*theta) ;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial black,avant garde"&gt;return (f);&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial black,avant garde"&gt;finish;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial black,avant garde"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 04 Aug 2019 14:06:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-write-the-Constraints-when-one-of-the-parameters-depends/m-p/578998#M4764</guid>
      <dc:creator>Salah</dc:creator>
      <dc:date>2019-08-04T14:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: how to write the Constraints when one of the parameters depends on the random variable</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-write-the-Constraints-when-one-of-the-parameters-depends/m-p/579033#M4765</link>
      <description>&lt;P&gt;Well, it's hard for me to determine if your program is correct or not because I don't understand what statistical problem you are trying to solve. However, my suggestion was for you to use&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;b=X-Mu;
if any(b&amp;lt;0) then 
   return( {1e20, 1e20, 1e20} );
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;in the FCT function immediately after you define the b vector.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Even if you are not doing MLE, I suggest you study the IML programs in the links I sent. There are several suggestions and best practices in the examples that I think would improve your program.&lt;/P&gt;</description>
      <pubDate>Sun, 04 Aug 2019 20:08:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-write-the-Constraints-when-one-of-the-parameters-depends/m-p/579033#M4765</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2019-08-04T20:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: how to write the Constraints when one of the parameters depends on the random variable</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-write-the-Constraints-when-one-of-the-parameters-depends/m-p/579049#M4766</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am sorry if I wasn't clear about my problem. I am trying to use the principle of maximum entropy to estimate the parameters of the Weibull distribution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To do this problem, I have to first&amp;nbsp; to construction the Lagrange multiplier (lambda0, lambda1 and lambda2). Then I derive the entropy function and find a connections/relation between the parameters and these lambdas.&amp;nbsp; After that I&amp;nbsp;find the derivatives of&amp;nbsp; the entropy function with respect to lambda0, lambda1 and lambda2. Finally I try to use the data and the relationship b/w these lambdas&amp;nbsp; and the parameters which I get in terms of&amp;nbsp; 3 nonlinear equations that I need to solve simultaneously.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-right" image-alt="Capture.JPG" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/31520i771D4835C7235C6C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;What I did in my code is to simulate data from Weibull then wrote these equations in subroutine and try to solve them. I used your recommendations unfortunately I keep getting the following message&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial black,avant garde" color="#FF0000"&gt;ERROR: HYQUAN Optimization cannot be completed.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial black,avant garde" color="#FF0000"&gt;ERROR: HYQUAN needs more than 200 iterations or 500 function calls.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to use&amp;nbsp;tc={10000 15000}; and define it inside the call function (see attached code), this time I received this warning message&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT face="arial black,avant garde" color="#FF0000"&gt;ERROR: HYQUAN Optimization cannot be completed.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial black,avant garde" color="#008000"&gt;WARNING: Optimization routine cannot improve the function value.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2019 00:26:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-write-the-Constraints-when-one-of-the-parameters-depends/m-p/579049#M4766</guid>
      <dc:creator>Salah</dc:creator>
      <dc:date>2019-08-05T00:26:25Z</dc:date>
    </item>
    <item>
      <title>Re: how to write the Constraints when one of the parameters depends on the random variable</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-write-the-Constraints-when-one-of-the-parameters-depends/m-p/579114#M4767</link>
      <description>&lt;P&gt;The following program is based on your code. I made a few efficiency improvements to eliminate unnecessary loops.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*** Solve a system of nonlinear equations in SAS/IML  **;
*** reference: https://blogs.sas.com/content/iml/2018/02/28/solve-system-nonlinear-equations-sas.html;

proc iml;
alpha=2; mu=4;  theta=1;  /*Assumed real values */
n=20; seed=2; k=100;

start fct(var) global (X,n);
   Alpha = var[1]; Mu = var[2]; Theta = var[3];
   f = j(1, 3, .);         /* return a ROW VECTOR */
   sum1=0;sum2=0;sum3=0;
    
   b=X-Mu;
   if any(b&amp;lt;0) then 
      return( {1e20, 1e20, 1e20} );

   sum1 = sum( log(b) );
   sum2 = sum( b##Alpha );
   sum3 = sum( log(b) # b##Alpha );

   f[1] = ( log(theta)+digamma(1.0))/alpha - sum1/n;
   f[2] = sum2/n - theta;
   f[3] = ( log(theta)+digamma(1.0)+1)/alpha + sum3/(n*theta) ;
   return (f);
finish;
 
Alpha1=J(k,1,.);mu1=J(k,1,.);theta1=J(k,1,.);

/* These are the parameters of the Weibull(theta,alpha,mu):   Theta&amp;gt;0      Alpha&amp;gt;0      Mu&amp;lt;X  */   
con = {0.01    0.01  0.01,  
       200     200   200}; 
     
x0 = {1.5 3 2};           /* initial guess */
optn = {3, 0};               
tc={10000 15000};

Do N1=1 to k;
   U = Uniform( J(n,1,seed) );
   X = ( - Theta* Log(1 - U ))##(1/Alpha) + Mu; 

   call nlphqn(rc, Soln, "fct", x0, optn, con,tc) ;
   if rc &amp;gt; 0 then 
      Alpha1[N1] = Soln[1]; Mu1[N1] = Soln[2]; Theta1[N1] = Soln[3];
   *print Soln;
End;

alpha_hat=Alpha1[:];
mu_hat=Mu1[:] ;
theta_hat=Theta1[:];

*print Alpha1 Mu1 Theta1;
print alpha_hat  mu_hat theta_hat ;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Aug 2019 12:36:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-write-the-Constraints-when-one-of-the-parameters-depends/m-p/579114#M4767</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2019-08-05T12:36:47Z</dc:date>
    </item>
    <item>
      <title>Re: how to write the Constraints when one of the parameters depends on the random variable</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-write-the-Constraints-when-one-of-the-parameters-depends/m-p/579167#M4768</link>
      <description>&lt;P&gt;Thank you so much Rick.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I highly appreciate that&amp;nbsp; you were so patient with me, God bless you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do I have to worry about the message below??&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial black,avant garde" color="#FF0000"&gt;ERROR: HYQUAN Optimization cannot be completed.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="arial black,avant garde" color="#339966"&gt;WARNING: Optimization routine cannot improve the function value.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial, helvetica, sans-serif" color="#000000"&gt;Does the above error&amp;nbsp;message has anything to do with initial values?&amp;nbsp; I looked at the link that you provided one of them is using SAS/studio to see the 3D graph which I don't have. Is there any other alternatives to picture the pdf and the MLEs?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="arial, helvetica, sans-serif" color="#000000"&gt;Thank you again for everything you do for us.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2019 16:52:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-write-the-Constraints-when-one-of-the-parameters-depends/m-p/579167#M4768</guid>
      <dc:creator>Salah</dc:creator>
      <dc:date>2019-08-05T16:52:48Z</dc:date>
    </item>
    <item>
      <title>Re: how to write the Constraints when one of the parameters depends on the random variable</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-write-the-Constraints-when-one-of-the-parameters-depends/m-p/579188#M4769</link>
      <description>&lt;P&gt;Are you seeing that error when you run EXACTLY the code I posted? Because I do not get that error when I run SAS/IML 15.1.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regardless, if you see that message a few times among the 100 simulated samples, it means that the optimization did not converge for certain samples. This can happen if your initial guess is not very good or if you are using very small simulated samples. (I classify N=20 as small for a three-parameter family.) For small simulated samples, you might get "unlucky" and &lt;A href="https://blogs.sas.com/content/iml/2016/11/23/sampling-variation-small-samples.html" target="_self"&gt;the sample does not look very much like a sample from the distribution with the specified parameters.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are two ways to handle the situation.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) Make a better initial guess&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) Report the results of the simulation by saying, "Of the k simulated samples, three did not converge. The results for the remaining samples are shown in Table 3...."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You shouldn't get that error (or not very often) for larger samples like N=100 or more.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2019 17:08:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-write-the-Constraints-when-one-of-the-parameters-depends/m-p/579188#M4769</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2019-08-05T17:08:10Z</dc:date>
    </item>
    <item>
      <title>Re: how to write the Constraints when one of the parameters depends on the random variable</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-write-the-Constraints-when-one-of-the-parameters-depends/m-p/579227#M4770</link>
      <description>&lt;P&gt;Yes i got the error message running the exact same code ( I am using SAS 9.4). I did try to work on the initial values by using one of the codes that you posted on this link. I succeeded for some values and I didn't for others.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I found this message&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;ERROR: Expecting page 3, got page -1 instead.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;ERROR: Page validation error while reading WORK.'SASTMP-000000001'n.ITEMSTOR.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;ERROR: File WORK.'SASTMP-000000001'n.ITEMSTOR is damaged. I/O processing did not complete.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At the beginning I thought that this message is due to getting negative likelihood function but even with +ve log-likelihood I get this message.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am not sure if I should omit the values that cause these error messages but in this case I won't cover a large spectrum of values?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Aug 2019 20:22:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-write-the-Constraints-when-one-of-the-parameters-depends/m-p/579227#M4770</guid>
      <dc:creator>Salah</dc:creator>
      <dc:date>2019-08-05T20:22:53Z</dc:date>
    </item>
    <item>
      <title>Re: how to write the Constraints when one of the parameters depends on the random variable</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-write-the-Constraints-when-one-of-the-parameters-depends/m-p/579300#M4771</link>
      <description>&lt;P&gt;PROC IML does not write itemstores, so that error message is coming from somewhere else. How are you running SAS? Are you using SAS Studio? Enterprise Guide? Are you using the SAS University Edition (UE free version)? The message says that the item store is corrupted, so maybe there was an installation issue.&amp;nbsp; I don't know.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I did not get any errors on SAS 9.4 on Windows. Are you running Linux (or on the SAS UE virtual machine?)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Again, for small simulated samples, you might occasionally get these nonconvergence issues. It will be worse in some regions of parameter space than in others. That is part of what a simulation study tells you, and you should report the results accordingly. FOr example, "for samples of size 20, the optimization only converges 80% of the time when alpha is smaller than [or larger than] ...."&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2019 10:13:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-write-the-Constraints-when-one-of-the-parameters-depends/m-p/579300#M4771</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2019-08-06T10:13:33Z</dc:date>
    </item>
    <item>
      <title>Re: how to write the Constraints when one of the parameters depends on the random variable</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-write-the-Constraints-when-one-of-the-parameters-depends/m-p/582704#M4785</link>
      <description>&lt;P&gt;Is this problem resolved or are there still problems? If it is resolved, please mark it as Solved.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wrote down some thoughts and tips about how to define constraints when the parameters in an optimization are constrained by the data and have a restricted domain. See the article &lt;A href="https://blogs.sas.com/content/iml/2019/08/21/tips-optimize-restricted-domain.html" target="_self"&gt;"Two tips for optimizing a function that has a restricted domain."&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 09:32:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/how-to-write-the-Constraints-when-one-of-the-parameters-depends/m-p/582704#M4785</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2019-08-21T09:32:15Z</dc:date>
    </item>
  </channel>
</rss>

