<?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: LEVMAR Optimization cannot be completed!!! in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/LEVMAR-Optimization-cannot-be-completed/m-p/756791#M5555</link>
    <description>&lt;P&gt;Also, please double-check your second equation in the MOM function. You seem to be using the second (non-centered) moment. Did you intend to use the variance or the second centered moment? I've only used this method to match the mean and the variance.&lt;/P&gt;</description>
    <pubDate>Mon, 26 Jul 2021 20:22:44 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2021-07-26T20:22:44Z</dc:date>
    <item>
      <title>LEVMAR Optimization cannot be completed!!!</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/LEVMAR-Optimization-cannot-be-completed/m-p/756750#M5553</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I am trying to use SAS/IML to solve a system of nonlinear equations. In the beginning, I succeeded till I used smaller values for the parameters, then I start receiving error messages (see attached log file). I noticed that the errors only occur when I do more simulations, 1000 for example. No errors when I run 1 or 2 simulations.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also want to say that I read your answer to a similar problem&amp;nbsp;&lt;SPAN&gt;(see the link below) but I couldn't implement it to my code. Didn't know where to put opt? There was no example in the link so I couldn't use that help.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-get-the-optimizations-results-when-the-error-occurs/td-p/206133" target="_blank"&gt;https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/How-to-get-the-optimizations-results-when-the-error-occurs/td-p/206133&lt;/A&gt;&lt;/SPAN&gt;&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;&lt;BR /&gt;%macro ODSOff();&lt;BR /&gt;ods graphics off;&lt;BR /&gt;ods exclude all;&lt;BR /&gt;ods noresults;&lt;BR /&gt;%mend;&lt;/P&gt;&lt;P&gt;%macro ODSOn();&lt;BR /&gt;ods graphics on;&lt;BR /&gt;ods exclude none;&lt;BR /&gt;ods results;&lt;BR /&gt;%mend;&lt;/P&gt;&lt;P&gt;%odsoff;&lt;/P&gt;&lt;P&gt;proc iml;&lt;/P&gt;&lt;P&gt;seed=12345; k=1000;&lt;/P&gt;&lt;P&gt;n=16; alpha =0.7; Lambda=1.5; *be careful for PWM, I had to assume that Lambda &amp;gt;1;&lt;/P&gt;&lt;P&gt;m=n; R=J(m,1,0);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;**** MLE ***;&lt;BR /&gt;&lt;BR /&gt;start MLE_func(y) global (n,m,X,R);&lt;/P&gt;&lt;P&gt;func=0;&lt;/P&gt;&lt;P&gt;alpha=y[1];&lt;BR /&gt;lambda=y[2];&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Sum_log=J(m,1,0);&lt;BR /&gt;Sum_log=log(x);&lt;/P&gt;&lt;P&gt;Sum_log_1=J(m,1,0);&lt;BR /&gt;Sum_log_1=log(1-X##lambda);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;func=func + m*log(alpha*lambda)+(lambda-1)* Sum_log[+] + (alpha-1) * Sum_log_1[+] ;&lt;/P&gt;&lt;P&gt;Return(func);&lt;BR /&gt;finish;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;*** Solve for MOM: by solving system of equations ***;&lt;BR /&gt;*******************************************************;&lt;BR /&gt;/* I solved the system of nonlinear equations using: &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;BR /&gt;&lt;BR /&gt;start MOM_Fun(var) global (n,m,X,R);&lt;/P&gt;&lt;P&gt;X_bar=X[:];&lt;BR /&gt;Xsqr=X##2;&lt;/P&gt;&lt;P&gt;alpha = var[1]; lambda = var[2];&lt;BR /&gt;f = j(1, 2, .); /* return a ROW VECTOR */&lt;BR /&gt;f[1] = X_bar-gamma(alpha+1)*gamma(1/lambda+1)/gamma(alpha+1/lambda+1);&lt;BR /&gt;f[2] = Xsqr[:] - alpha*gamma(alpha)*gamma(2/lambda+1)/gamma(alpha+2/lambda+1);&lt;BR /&gt;return (f);&lt;BR /&gt;finish;&lt;/P&gt;&lt;P&gt;*** Solve for PWM: by solving system of equations ***;&lt;BR /&gt;*******************************************************;&lt;BR /&gt;start PWM_Fun(var) global (n,m,X,R);&lt;/P&gt;&lt;P&gt;alpha = var[1]; lambda = var[2];&lt;/P&gt;&lt;P&gt;call sort (X);&lt;BR /&gt;X_bar=X[:];&lt;/P&gt;&lt;P&gt;Sum=0;&lt;BR /&gt;do i=1 to n;&lt;BR /&gt;sum=sum+(n-i)*X[i];&lt;BR /&gt;end;&lt;BR /&gt;sum1=sum/(n*(n-1));&lt;BR /&gt;&lt;BR /&gt;pi=constant("pi");&lt;BR /&gt;B=-lambda*gamma(1-1/lambda);&lt;/P&gt;&lt;P&gt;f = j(1, 2, .);&lt;BR /&gt;f[1] = X_bar + pi* alpha * CSC(pi/lambda)* gamma(alpha)/( gamma( alpha + 1/lambda + 1)* B );&lt;BR /&gt;f[2] = sum1 + pi* alpha * CSC(pi/lambda)* gamma(2*alpha)/( gamma( 2*alpha + 1/lambda + 1)* B );&lt;BR /&gt;return (f);&lt;BR /&gt;finish;&lt;/P&gt;&lt;P&gt;*** Solve for SDPWM: by solving system of equations ***;&lt;BR /&gt;*******************************************************;&lt;/P&gt;&lt;P&gt;start SDPWM_Fun(var) global (n,m,X,R);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;alpha = var[1]; lambda = var[2];&lt;/P&gt;&lt;P&gt;call sort (X);&lt;BR /&gt;X_bar=X[:];&lt;BR /&gt;Sum= (1-X##lambda)##alpha # X;&lt;/P&gt;&lt;P&gt;pi=constant("pi");&lt;BR /&gt;B=-lambda*gamma(1-1/lambda);&lt;/P&gt;&lt;P&gt;f = j(1, 2, .);&lt;BR /&gt;f[1] = X_bar + pi* alpha * CSC(pi/lambda)* gamma(alpha)/( gamma( alpha + 1/lambda + 1)* B );&lt;BR /&gt;f[2] = sum[:] + pi* alpha * CSC(pi/lambda)* gamma(2*alpha)/( gamma( 2*alpha + 1/lambda + 1)* B );&lt;BR /&gt;return (f);&lt;BR /&gt;finish;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;*** Solve for Shanon Entropy: by solving system of equations ***;&lt;BR /&gt;*******************************************************;&lt;/P&gt;&lt;P&gt;start Shanon_Fun(var) global (n,m,X,R);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;alpha = var[1]; lambda = var[2];&lt;/P&gt;&lt;P&gt;call sort (X);&lt;/P&gt;&lt;P&gt;LNX= log(X);&lt;BR /&gt;LNXB=Log(1-X##lambda);&lt;BR /&gt;Sum=LNX#digamma(1-X##lambda);&lt;/P&gt;&lt;P&gt;f = j(1, 2, .);&lt;BR /&gt;f[1] = LNX[:]+( digamma(alpha+1)- digamma(1) )/lambda;&lt;BR /&gt;f[2] = LNXB[:] + ( digamma(alpha+1)- digamma(alpha) );&lt;BR /&gt;*f[3]= (1-alpha)*Sum[:]+( digamma(alpha+1)- digamma(1) -1 )/lambda;&lt;BR /&gt;return (f);&lt;BR /&gt;finish;&lt;/P&gt;&lt;P&gt;********************* Simulation Step ***************************;&lt;/P&gt;&lt;P&gt;alpha_MLE=J(k,1,0); lambda_MLE=J(k,1,0);&lt;BR /&gt;alpha_Mom=J(k,1,0); lambda_Mom=J(k,1,0);&lt;BR /&gt;alpha_PMW=J(K,1,0); lambda_PMW=J(K,1,0);&lt;BR /&gt;alpha_SDPMW=J(k,1,0); lambda_SDPMW=J(k,1,0);&lt;BR /&gt;alpha_Shanon=J(k,1,0); lambda_Shanon=J(k,1,0);&lt;BR /&gt;MSE_MLE_a=J(K,1,0); MSE_MLE_L=J(K,1,0);&lt;BR /&gt;MSE_MOM_a=J(K,1,0); MSE_MOM_L=J(K,1,0);&lt;BR /&gt;MSE_PMW_a=J(K,1,0); MSE_PMW_L=J(K,1,0);&lt;BR /&gt;MSE_SDPMW_a=J(K,1,0); MSE_SDPMW_L=J(K,1,0);&lt;BR /&gt;MSE_Shanon_a=J(K,1,0); MSE_Shanon_L=J(K,1,0);&lt;/P&gt;&lt;P&gt;Do N1=1 to K;&lt;/P&gt;&lt;P&gt;W=J(m,1,0);V=J(m,1,0);X_p=J(m,1,0); X=J(m,1,0); U=J(m,1,0);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;do i=1 to m;&lt;BR /&gt;W[i]=Uniform(seed);&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;S=1+R[m];&lt;BR /&gt;V[1]=W[1]**(1/S);&lt;/P&gt;&lt;P&gt;do i=2 to m;&lt;BR /&gt;S=S+(1+R[m-i+1]);&lt;BR /&gt;V[i]=W[i]**(1/S);&lt;BR /&gt;end;&lt;BR /&gt;&lt;BR /&gt;do i=1 to m;&lt;/P&gt;&lt;P&gt;U[i]=1-prod( V[ m:( m-i+1)] );** the U's are the required progressively type II from U(0,1);&lt;/P&gt;&lt;P&gt;END;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;X=( 1-(1-U)##(1/alpha) )##(1/lambda);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;****************************************************************** ;&lt;BR /&gt;*** MLE for the Kumaraswamy ***** ;&lt;BR /&gt;*******************************************************************;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;************* Constrain MLE ***********************;&lt;/P&gt;&lt;P&gt;con={0.01 0.01 , . .};&lt;BR /&gt;x0={0.05, 0.05};&lt;BR /&gt;opt={2 1};&lt;BR /&gt;tc={10000 14000};&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;call nlpnra(rc, MLE_ret, "MLE_func", x0, opt, con,tc);&lt;/P&gt;&lt;P&gt;alpha_mle[N1] =MLE_ret[1];&lt;BR /&gt;lambda_mle[N1]=MLE_ret[2];&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;************************* Find MOM ************************;&lt;BR /&gt;&lt;BR /&gt;/* x[1] x[2] constraints. Lower bounds in 1st row; upper bounds in 2nd row */&lt;BR /&gt;con = {1e-3 1e-3, . .}; /* x[1] &amp;gt; 0 and x[2] &amp;gt; 0; */&lt;BR /&gt;&lt;BR /&gt;x0 = {0.5 1.1}; /* initial guess */&lt;BR /&gt;optn = {2 /* solve least square problem that has 3 components */&lt;BR /&gt;1}; /* amount of printing */&lt;/P&gt;&lt;P&gt;call NLPLM(rc, Soln, "MOM_Fun", x0, optn) blc=con; /* or use nlphqn */&lt;BR /&gt;alpha_mom[N1]=Soln[1];&lt;BR /&gt;lambda_mom[N1]=Soln[2];&lt;/P&gt;&lt;P&gt;************************* Find PWM ************************;&lt;BR /&gt;&lt;BR /&gt;call nlphqn(rc, Soln1, "PWM_Fun", x0, optn) blc=con;&lt;BR /&gt;alpha_PMW[N1]=Soln1[1];&lt;BR /&gt;lambda_PMW[N1]=Soln1[2];&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;************************ Find SDPWM ************************;&lt;BR /&gt;&lt;BR /&gt;call nlphqn(rc, Soln2, "SDPWM_Fun", x0, optn) blc=con;&lt;BR /&gt;alpha_SDPMW[N1]=Soln2[1];&lt;BR /&gt;lambda_SDPMW[N1]=Soln2[2];&lt;/P&gt;&lt;P&gt;************************* Find Shanon ************************;&lt;BR /&gt;&lt;BR /&gt;call nlphqn(rc, Soln3, "Shanon_Fun", x0, optn) blc=con;&lt;BR /&gt;alpha_Shanon[N1]=Soln3[1];&lt;BR /&gt;lambda_Shanon[N1]=Soln3[2];&lt;/P&gt;&lt;P&gt;*MSE alpha;&lt;BR /&gt;**********;&lt;/P&gt;&lt;P&gt;MSE_MLE_a[N1]=(alpha_mle[N1]-alpha)**2;&lt;/P&gt;&lt;P&gt;MSE_MOM_a[N1]=(alpha_MOM[N1]-alpha)**2;&lt;/P&gt;&lt;P&gt;MSE_PMW_a[N1]=(alpha_PMW[N1]-alpha)**2;&lt;/P&gt;&lt;P&gt;MSE_SDPMW_a[N1]=(alpha_SDPMW[N1]-alpha)**2;&lt;/P&gt;&lt;P&gt;MSE_Shanon_a[N1]=(alpha_Shanon[N1]-alpha)**2;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;*MSE Lambda;&lt;BR /&gt;**********;&lt;/P&gt;&lt;P&gt;MSE_MLE_L[N1]=(Lambda_mle[N1]-Lambda)**2;&lt;/P&gt;&lt;P&gt;MSE_MOM_L[N1]=(Lambda_MOM[N1]-Lambda)**2;&lt;/P&gt;&lt;P&gt;MSE_PMW_L[N1]=(Lambda_PMW[N1]-Lambda)**2;&lt;/P&gt;&lt;P&gt;MSE_SDPMW_L[N1]=(Lambda_SDPMW[N1]-Lambda)**2;&lt;/P&gt;&lt;P&gt;MSE_Shanon_L[N1]=(Lambda_Shanon[N1]-Lambda)**2;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;**************************************************************************;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;End;&lt;BR /&gt;%odson&lt;BR /&gt;MLE_alpha_hat=alpha_mle[:];&lt;BR /&gt;MLE_lambda_hat=lambda_mle[:];&lt;/P&gt;&lt;P&gt;Mom_alpha_hat =alpha_Mom[:];&lt;BR /&gt;Mom_lambda_hat=lambda_Mom[:];&lt;/P&gt;&lt;P&gt;PMW_alpha_hat =alpha_PMW[:];&lt;BR /&gt;PMW_lambda_hat=lambda_PMW[:];&lt;/P&gt;&lt;P&gt;SDPMW_alpha_hat =alpha_SDPMW[:];&lt;BR /&gt;SDPMW_lambda_hat=lambda_SDPMW[:];&lt;/P&gt;&lt;P&gt;Shanon_alpha_hat =alpha_Shanon[:];&lt;BR /&gt;Shanon_lambda_hat=lambda_Shanon[:];&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;print alpha lambda;&lt;BR /&gt;print MLE_alpha_hat MLE_lambda_hat;&lt;BR /&gt;print Mom_alpha_hat Mom_lambda_hat;&lt;BR /&gt;Print PMW_alpha_hat PMW_lambda_hat;&lt;BR /&gt;Print SDPMW_alpha_hat SDPMW_lambda_hat;&lt;BR /&gt;Print Shanon_alpha_hat Shanon_lambda_hat;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jul 2021 18:32:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/LEVMAR-Optimization-cannot-be-completed/m-p/756750#M5553</guid>
      <dc:creator>Salah</dc:creator>
      <dc:date>2021-07-26T18:32:56Z</dc:date>
    </item>
    <item>
      <title>Re: LEVMAR Optimization cannot be completed!!!</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/LEVMAR-Optimization-cannot-be-completed/m-p/756765#M5554</link>
      <description>&lt;P&gt;There is a general way to solve these problems.&lt;/P&gt;
&lt;P&gt;1. Scroll down in the log until you see the first ERROR message. In this case, it says&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;ERROR: (execution) Invalid argument to function.&lt;/SPAN&gt;&lt;SPAN&gt;operation : &lt;BR /&gt;GAMMA at line 76 column 37&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;operands : _TEM1004&lt;/SPAN&gt;&lt;SPAN&gt;_TEM1004 1 row 1 col (numeric)&lt;/SPAN&gt;&lt;SPAN&gt;1000001&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This tells you that the problem is in a call to the GAMMA function, which is on Line 76 (Col=37) of the log. It says that the operand (which means argument to the function) is a 1x1 matrix that has the value&amp;nbsp;1000001.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2. Go to line 76 in the log. There you will see the call to the GAMMA function. I don't know which call is failing, but it might be GAMMA(1/lambda+1). Notice that lambda is not constrained away from zero, so it is possible that you are seeing lambda-&amp;gt;0, which causes the GAMMA function of 1/lambda to blow up.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;So, what to do?&amp;nbsp; Your program is too long (275 lines) for me to try to understand it, so my suggestion is that you try to isolate the issue and reproduce it in a simpler program. When you isolate the problem, the solution will sometimes be more apparent. Some other ideas:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;1. In optimization problems, it is often sufficient to optimize the LOG of a function. Can you work with the LOG of the expression? LOG( -gamma(alpha+1)*gamma(1/lambda+1)/gamma(alpha+1/lambda+1)) can be expressed in terms of the&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;LGAMMA function.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2. Be sure you can solve ONE problem before you attempt to embed the problem in a simulation study that needs to solve thousands of problems.&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;3. Explain in words why you are trying to solve these simultaneous equations. There might be an easier way.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jul 2021 19:23:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/LEVMAR-Optimization-cannot-be-completed/m-p/756765#M5554</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2021-07-26T19:23:46Z</dc:date>
    </item>
    <item>
      <title>Re: LEVMAR Optimization cannot be completed!!!</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/LEVMAR-Optimization-cannot-be-completed/m-p/756791#M5555</link>
      <description>&lt;P&gt;Also, please double-check your second equation in the MOM function. You seem to be using the second (non-centered) moment. Did you intend to use the variance or the second centered moment? I've only used this method to match the mean and the variance.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jul 2021 20:22:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/LEVMAR-Optimization-cannot-be-completed/m-p/756791#M5555</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2021-07-26T20:22:44Z</dc:date>
    </item>
    <item>
      <title>Re: LEVMAR Optimization cannot be completed!!!</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/LEVMAR-Optimization-cannot-be-completed/m-p/756793#M5556</link>
      <description>&lt;P&gt;Thank you for the reply. I am trying to estimate the parameters using the method of moments. So far when the sample size is large at least 20 and with alpha =0.7 and beta=&amp;gt;1.5 then there is no problem. However, If I take n=15 and up to 100 simulations then there is no problem with the code. So I was encouraged to take 1000 simulations and that is when I start having troubles. To answer your second question I am using the first and second moments. I didn't use the variance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="MOM1.jpg" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/61705i53D72783E3E0229F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MOM1.jpg" alt="MOM1.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jul 2021 20:27:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/LEVMAR-Optimization-cannot-be-completed/m-p/756793#M5556</guid>
      <dc:creator>Salah</dc:creator>
      <dc:date>2021-07-26T20:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: LEVMAR Optimization cannot be completed!!!</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/LEVMAR-Optimization-cannot-be-completed/m-p/756795#M5557</link>
      <description>&lt;P&gt;What is the distribution?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jul 2021 20:31:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/LEVMAR-Optimization-cannot-be-completed/m-p/756795#M5557</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2021-07-26T20:31:09Z</dc:date>
    </item>
    <item>
      <title>Re: LEVMAR Optimization cannot be completed!!!</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/LEVMAR-Optimization-cannot-be-completed/m-p/756808#M5558</link>
      <description>&lt;P&gt;Thanks for posting the equations. Instead of solving&amp;nbsp;&lt;/P&gt;
&lt;P&gt;f1(alpha, lambda) = A&lt;/P&gt;
&lt;P&gt;f2(alpha, lambda) = B&lt;/P&gt;
&lt;P&gt;you should solve&lt;/P&gt;
&lt;P&gt;log( f1(alpha, lambda) ) = log(A)&lt;/P&gt;
&lt;P&gt;log( f2(alpha, lambda) ) = log(B)&lt;/P&gt;
&lt;P&gt;This enables you to use the LGAMMA function instead of the GAMMA function. For more information, see&amp;nbsp;&lt;A href="https://blogs.sas.com/content/iml/2016/11/16/need-log-transform-distribution-theres-sas-function.html" target="_blank"&gt;Need to log-transform a distribution? There's a SAS function for that! - The DO Loop&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;start MOM_Fun(var) global (X);
   X_bar=X[:];
   Xsqr_bar=(X##2)[:];

   alpha = var[1]; lambda = var[2];
   f = j(1, 2, .); /* return a ROW VECTOR */
   f[1] = log(X_bar) - 
          (lgamma(alpha+1) + lgamma(1/lambda+1) - lgamma(alpha+1/lambda+1));
   f[2] = log(Xsqr_bar) - 
           (log(alpha) + lgamma(alpha) + lgamma(2/lambda+1) - lgamma(alpha+2/lambda+1));
   return (f);
finish;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jul 2021 21:03:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/LEVMAR-Optimization-cannot-be-completed/m-p/756808#M5558</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2021-07-26T21:03:20Z</dc:date>
    </item>
    <item>
      <title>Re: LEVMAR Optimization cannot be completed!!!</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/LEVMAR-Optimization-cannot-be-completed/m-p/756813#M5559</link>
      <description>&lt;P&gt;That is brilliant thank you so much&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jul 2021 21:34:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/LEVMAR-Optimization-cannot-be-completed/m-p/756813#M5559</guid>
      <dc:creator>Salah</dc:creator>
      <dc:date>2021-07-26T21:34:17Z</dc:date>
    </item>
  </channel>
</rss>

