<?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: Error in the minimization solution with proc iml nlpnra with grd option in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-in-the-minimization-solution-with-proc-iml-nlpnra-with-grd/m-p/537629#M4572</link>
    <description>&lt;P&gt;I think the following will fix the problem.&amp;nbsp; Always use a row vector for x0 and don't try to modify x within the functions F and G.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
use test;
read all into in_data;

start F(x) global(in_data);
f = sum(exp(in_data*x`));
return(f);
finish F;

start G(x) global(in_data);
g = (exp(in_data*x`)`)*in_data;
return(g);
finish G;

x0 = {0 0 0};
optn = {0 2};
call nlpnra(rc, xres, "F", x0, optn) grd="G";

print xres;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 22 Feb 2019 11:09:02 GMT</pubDate>
    <dc:creator>IanWakeling</dc:creator>
    <dc:date>2019-02-22T11:09:02Z</dc:date>
    <item>
      <title>Error in the minimization solution with proc iml nlpnra with grd option</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-in-the-minimization-solution-with-proc-iml-nlpnra-with-grd/m-p/537627#M4571</link>
      <description>&lt;P&gt;Dears,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to apply the minimization algorithm mentioned in the attached pdf with SAS 9.2.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the following code with the data attached (values already centered).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc iml;&lt;BR /&gt;use in_data;&lt;BR /&gt;read all into in_data;&lt;BR /&gt;in_data=in_data;&lt;/P&gt;&lt;P&gt;start F(x) global(in_data);&lt;BR /&gt;x = {0, 0, 0};&lt;BR /&gt;f = sum(exp(in_data*x));&lt;BR /&gt;return(f);&lt;BR /&gt;finish F;&lt;/P&gt;&lt;P&gt;start G(x) global(in_data);&lt;BR /&gt;x = {0, 0, 0};&lt;BR /&gt;g = (exp(in_data*x)`)*in_data;&lt;BR /&gt;return(g);&lt;BR /&gt;finish G;&lt;/P&gt;&lt;P&gt;x = {0, 0, 0};&lt;BR /&gt;optn = {0 2};&lt;BR /&gt;call nlpnra(rc, xres, "F", x, optn) grd="G";&lt;/P&gt;&lt;P&gt;print xres;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;xres gives me the following result:&amp;nbsp;0.0301847 -0.008427 0.0540752&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I use R, I get the following results:&amp;nbsp;0.4941690 -0.2042731 1.5939447. I would like to know how could I fix the code so that the results are more similar to those provided by R.&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be highly appreciated.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Feb 2019 10:19:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-in-the-minimization-solution-with-proc-iml-nlpnra-with-grd/m-p/537627#M4571</guid>
      <dc:creator>zocoj</dc:creator>
      <dc:date>2019-02-22T10:19:30Z</dc:date>
    </item>
    <item>
      <title>Re: Error in the minimization solution with proc iml nlpnra with grd option</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-in-the-minimization-solution-with-proc-iml-nlpnra-with-grd/m-p/537629#M4572</link>
      <description>&lt;P&gt;I think the following will fix the problem.&amp;nbsp; Always use a row vector for x0 and don't try to modify x within the functions F and G.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
use test;
read all into in_data;

start F(x) global(in_data);
f = sum(exp(in_data*x`));
return(f);
finish F;

start G(x) global(in_data);
g = (exp(in_data*x`)`)*in_data;
return(g);
finish G;

x0 = {0 0 0};
optn = {0 2};
call nlpnra(rc, xres, "F", x0, optn) grd="G";

print xres;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Feb 2019 11:09:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-in-the-minimization-solution-with-proc-iml-nlpnra-with-grd/m-p/537629#M4572</guid>
      <dc:creator>IanWakeling</dc:creator>
      <dc:date>2019-02-22T11:09:02Z</dc:date>
    </item>
    <item>
      <title>Re: Error in the minimization solution with proc iml nlpnra with grd option</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-in-the-minimization-solution-with-proc-iml-nlpnra-with-grd/m-p/537630#M4573</link>
      <description>Thanks a lot! it works :).</description>
      <pubDate>Fri, 22 Feb 2019 11:18:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-in-the-minimization-solution-with-proc-iml-nlpnra-with-grd/m-p/537630#M4573</guid>
      <dc:creator>zocoj</dc:creator>
      <dc:date>2019-02-22T11:18:30Z</dc:date>
    </item>
  </channel>
</rss>

