<?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 call  nlpnra returns the same value each time ? in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/call-nlpnra-returns-the-same-value-each-time/m-p/760573#M5600</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working on an optimization problem inside a bootstrap. I found out that I get the same result for each bootstrap. I checked my data as I was worried that it might be degenerated data which is not the case. I don't know what causes the nlpnra to return the same MLE? I also tried different functions like nlpqn but that didn't change anything.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc iml;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;m=40; B=10;&lt;BR /&gt;alpha =1; Lambda=1.5;&lt;BR /&gt;&lt;BR /&gt;** Data simulation&amp;nbsp; **;&lt;BR /&gt;************************;&lt;BR /&gt;start Data(alpha,lambda,m) ;&lt;BR /&gt;seed=0;&lt;BR /&gt;U=ranuni(repeat(seed,m,1));&lt;BR /&gt;X=( 1-(1-U)##(1/alpha) )##(1/lambda);&lt;BR /&gt;return(X);&lt;BR /&gt;finish;&lt;BR /&gt;*******************************************************;&lt;BR /&gt;start MLE_func(y) global(X,X1);&lt;BR /&gt;m=nrow(x);&lt;BR /&gt;func=0;&lt;BR /&gt;alpha=y[1];&lt;BR /&gt;lambda=y[2];&lt;BR /&gt;&lt;BR /&gt;Sum_log=J(m,1,0);&lt;BR /&gt;Sum_log=log(x);&lt;BR /&gt;Sum_log_1=J(m,1,0);&lt;BR /&gt;Sum_log_1=log(1-X##lambda);&lt;/P&gt;&lt;P&gt;func=func + m*log(alpha*lambda)+(lambda-1)* Sum_log[+] + (alpha-1) * Sum_log_1[+] ;&lt;BR /&gt;Return(func);&lt;BR /&gt;finish;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;con = {1e-6 1e-6, . .};&lt;BR /&gt;optn = {2 0};&lt;BR /&gt;tc={10000 14000};&lt;/P&gt;&lt;P&gt;********************************************;&lt;BR /&gt;*** Bootstrap Steps ***;&lt;BR /&gt;********************************************;&lt;/P&gt;&lt;P&gt;Step1:&lt;BR /&gt;&lt;BR /&gt;X=Data(alpha,lambda,m);&lt;BR /&gt;x0_MLE= {0.05, 0.05};&lt;BR /&gt;call nlpnra(rc, MLE_ret, "MLE_func", x0_MLE, optn, con,tc);&lt;BR /&gt;alpha_mle = MLE_ret[1];&lt;BR /&gt;lambda_mle = MLE_ret[2];&lt;/P&gt;&lt;P&gt;*****************************************************************;&lt;BR /&gt;Step2:&lt;BR /&gt;&lt;BR /&gt;B_alpha1 = J(B,1,0); B_Lambda1 = J(B,1,0);&lt;BR /&gt;&lt;BR /&gt;Do i=1 to B;&lt;BR /&gt;&lt;BR /&gt;X1=Data(alpha_mle,lambda_mle,m);&lt;BR /&gt;x0_MLE = MLE_ret[1] || MLE_ret[2];&lt;/P&gt;&lt;P&gt;call nlpnra(rc, MLE_ret, "MLE_func", x0_MLE, optn, con,tc);&lt;BR /&gt;B_alpha1[i] = MLE_ret[1];&lt;BR /&gt;B_lambda1[i] = MLE_ret[2];&lt;BR /&gt;&lt;BR /&gt;***********************************************************************;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;print B_alpha1 B_lambda1 ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;</description>
    <pubDate>Tue, 10 Aug 2021 10:23:40 GMT</pubDate>
    <dc:creator>Salah</dc:creator>
    <dc:date>2021-08-10T10:23:40Z</dc:date>
    <item>
      <title>call  nlpnra returns the same value each time ?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/call-nlpnra-returns-the-same-value-each-time/m-p/760573#M5600</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am working on an optimization problem inside a bootstrap. I found out that I get the same result for each bootstrap. I checked my data as I was worried that it might be degenerated data which is not the case. I don't know what causes the nlpnra to return the same MLE? I also tried different functions like nlpqn but that didn't change anything.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc iml;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;m=40; B=10;&lt;BR /&gt;alpha =1; Lambda=1.5;&lt;BR /&gt;&lt;BR /&gt;** Data simulation&amp;nbsp; **;&lt;BR /&gt;************************;&lt;BR /&gt;start Data(alpha,lambda,m) ;&lt;BR /&gt;seed=0;&lt;BR /&gt;U=ranuni(repeat(seed,m,1));&lt;BR /&gt;X=( 1-(1-U)##(1/alpha) )##(1/lambda);&lt;BR /&gt;return(X);&lt;BR /&gt;finish;&lt;BR /&gt;*******************************************************;&lt;BR /&gt;start MLE_func(y) global(X,X1);&lt;BR /&gt;m=nrow(x);&lt;BR /&gt;func=0;&lt;BR /&gt;alpha=y[1];&lt;BR /&gt;lambda=y[2];&lt;BR /&gt;&lt;BR /&gt;Sum_log=J(m,1,0);&lt;BR /&gt;Sum_log=log(x);&lt;BR /&gt;Sum_log_1=J(m,1,0);&lt;BR /&gt;Sum_log_1=log(1-X##lambda);&lt;/P&gt;&lt;P&gt;func=func + m*log(alpha*lambda)+(lambda-1)* Sum_log[+] + (alpha-1) * Sum_log_1[+] ;&lt;BR /&gt;Return(func);&lt;BR /&gt;finish;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;con = {1e-6 1e-6, . .};&lt;BR /&gt;optn = {2 0};&lt;BR /&gt;tc={10000 14000};&lt;/P&gt;&lt;P&gt;********************************************;&lt;BR /&gt;*** Bootstrap Steps ***;&lt;BR /&gt;********************************************;&lt;/P&gt;&lt;P&gt;Step1:&lt;BR /&gt;&lt;BR /&gt;X=Data(alpha,lambda,m);&lt;BR /&gt;x0_MLE= {0.05, 0.05};&lt;BR /&gt;call nlpnra(rc, MLE_ret, "MLE_func", x0_MLE, optn, con,tc);&lt;BR /&gt;alpha_mle = MLE_ret[1];&lt;BR /&gt;lambda_mle = MLE_ret[2];&lt;/P&gt;&lt;P&gt;*****************************************************************;&lt;BR /&gt;Step2:&lt;BR /&gt;&lt;BR /&gt;B_alpha1 = J(B,1,0); B_Lambda1 = J(B,1,0);&lt;BR /&gt;&lt;BR /&gt;Do i=1 to B;&lt;BR /&gt;&lt;BR /&gt;X1=Data(alpha_mle,lambda_mle,m);&lt;BR /&gt;x0_MLE = MLE_ret[1] || MLE_ret[2];&lt;/P&gt;&lt;P&gt;call nlpnra(rc, MLE_ret, "MLE_func", x0_MLE, optn, con,tc);&lt;BR /&gt;B_alpha1[i] = MLE_ret[1];&lt;BR /&gt;B_lambda1[i] = MLE_ret[2];&lt;BR /&gt;&lt;BR /&gt;***********************************************************************;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;print B_alpha1 B_lambda1 ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Aug 2021 10:23:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/call-nlpnra-returns-the-same-value-each-time/m-p/760573#M5600</guid>
      <dc:creator>Salah</dc:creator>
      <dc:date>2021-08-10T10:23:40Z</dc:date>
    </item>
    <item>
      <title>Re: call  nlpnra returns the same value each time ?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/call-nlpnra-returns-the-same-value-each-time/m-p/760577#M5601</link>
      <description>&lt;P&gt;This is a duplicate of&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Bootstrap-with-maximization-problem/m-p/760194" target="_blank"&gt;Solved: Re: Bootstrap with maximization problem - SAS Support Communities&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;where I answered the question. The answer is that the&amp;nbsp;MLE_func function uses the global variable X, which is always has the same value inside the loop DO i=1 to B.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Change the line&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;X1&lt;/STRONG&gt;=Data(alpha_mle,lambda_mle,m);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;to&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;STRONG&gt;X&lt;/STRONG&gt;=Data(alpha_mle,lambda_mle,m);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Aug 2021 10:51:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/call-nlpnra-returns-the-same-value-each-time/m-p/760577#M5601</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2021-08-10T10:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: call  nlpnra returns the same value each time ?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/call-nlpnra-returns-the-same-value-each-time/m-p/760578#M5602</link>
      <description>&lt;P&gt;I should not use X, X1, and X2 for my data. Just use X&lt;/P&gt;</description>
      <pubDate>Tue, 10 Aug 2021 10:57:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/call-nlpnra-returns-the-same-value-each-time/m-p/760578#M5602</guid>
      <dc:creator>Salah</dc:creator>
      <dc:date>2021-08-10T10:57:31Z</dc:date>
    </item>
  </channel>
</rss>

