<?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 Using NLPNRA and PROC IML for Maximum Likelihood Estimation in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-in-Using-NLPNRA-and-PROC-IML-for-Maximum-Likelihood/m-p/165535#M1604</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your prompt reply, Rick! 1) After reading your comment and thinking really hard, I'm still struggling to translate the inequality p + q &amp;lt; 1 into that constraint matrix.&amp;nbsp; Could you please provide a hint? 2) I re-wrote the objective function into the likelihood (instead of the log-likelihood) so that there are no more logarithms.&amp;nbsp; f = (p**2 + 2*p*(1-p-q))**na + (q**2 + 2*p*(1-p-q))**nb + (2*p*q)**nab + ((1-p-q)**2)**no; I used the original constraint con = { 0 0,&amp;nbsp;&amp;nbsp; 1 1}; However, this method is problematic because of round-off error - each term is zero because a small number is exponentiated by a big number.&amp;nbsp; Is there any way to overcome this while still retaining the likelihood as the objective function? ***I now realize that the log-likelihood is better as the objective function for numerical purposes because of less round-off error. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 20 May 2014 02:33:20 GMT</pubDate>
    <dc:creator>EricCai</dc:creator>
    <dc:date>2014-05-20T02:33:20Z</dc:date>
    <item>
      <title>Error in Using NLPNRA and PROC IML for Maximum Likelihood Estimation</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-in-Using-NLPNRA-and-PROC-IML-for-Maximum-Likelihood/m-p/165533#M1602</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Community,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to follow &lt;A href="http://blogs.sas.com/content/iml/2011/10/12/maximum-likelihood-estimation-in-sasiml/"&gt;Rick Wicklin's example of using NLPNRA with PROC IML for maximum likelihood estimation&lt;/A&gt;. Unfortunately, I am encountering an error with NLPNRA.&amp;nbsp; I am struggling to find the proper documentation for how to use it and what its inputs mean; the documentation page entitled "&lt;A href="https://support.sas.com/documentation/cdl/en/imlug/59656/HTML/default/viewer.htm#langref_sect189.htm"&gt;NLPNRA Call&lt;/A&gt;" is not helpful.&amp;nbsp; Thus, I would much appreciate any help that you can provide.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My questions:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) What are the possible inputs for NLPNRA?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) The first 2 inputs for NLPNRA are "rc" and "xr".&amp;nbsp; What do they mean?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) I am getting the error "(execution) Invalid argument to function." in my log.&amp;nbsp; (See below for more details.)&amp;nbsp; What does this error mean?&amp;nbsp; What am I doing incorrectly?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Eric&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000;"&gt;&lt;STRONG&gt;Here is my script; notice that my log-likelihood is assigned to the variable "f".&amp;nbsp; &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;SPAN class="s1"&gt;dm&lt;/SPAN&gt;&lt;SPAN class="s2"&gt; &lt;/SPAN&gt;'cle log; cle out; cle odsresults;'&lt;SPAN class="s2"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;SPAN class="s1"&gt;dm&lt;/SPAN&gt;&lt;SPAN class="s2"&gt; &lt;/SPAN&gt;'odsresults; clear'&lt;SPAN class="s2"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p3"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;ods&lt;SPAN class="s2"&gt; &lt;/SPAN&gt;html&lt;SPAN class="s2"&gt; &lt;/SPAN&gt;close&lt;SPAN class="s2"&gt;; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p3"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;ods&lt;SPAN class="s2"&gt; &lt;/SPAN&gt;html&lt;SPAN class="s2"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p3"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;ods&lt;SPAN class="s2"&gt; &lt;/SPAN&gt;listing&lt;SPAN class="s2"&gt; &lt;/SPAN&gt;close&lt;SPAN class="s2"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p3"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;ods&lt;SPAN class="s2"&gt; &lt;/SPAN&gt;listing&lt;SPAN class="s2"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p3"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;options&lt;SPAN class="s2"&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p3"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;SPAN class="s2"&gt; &lt;/SPAN&gt;noovp&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p4"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; linesize = &lt;SPAN class="s3"&gt;&lt;STRONG&gt;105&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p3"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;SPAN class="s2"&gt; &lt;/SPAN&gt;formdlim&lt;SPAN class="s2"&gt; = &lt;/SPAN&gt;&lt;SPAN class="s4"&gt;'-'&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p4"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; pageno = min&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p4"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;SPAN class="s1"&gt;title&lt;/SPAN&gt;&lt;SPAN class="s2"&gt; &lt;/SPAN&gt;"Using Newton's Method to Maximize the Log-Likelihood of Parameters in ABO-Blood Type Under Hardy-Weinberg Equilibrium"&lt;SPAN class="s2"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p5"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;SPAN class="s2"&gt; &lt;/SPAN&gt;&lt;STRONG&gt;iml&lt;/STRONG&gt;&lt;SPAN class="s2"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p4"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; &lt;SPAN class="s1"&gt;start&lt;/SPAN&gt; loglik(param) global(x);&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p4"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; p = param[&lt;SPAN class="s3"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;];&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p4"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; q = param[&lt;SPAN class="s3"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/SPAN&gt;];&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p4"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; na = &lt;SPAN class="s3"&gt;&lt;STRONG&gt;9123&lt;/STRONG&gt;&lt;/SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p4"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; nb = &lt;SPAN class="s3"&gt;&lt;STRONG&gt;2987&lt;/STRONG&gt;&lt;/SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p4"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; nab = &lt;SPAN class="s3"&gt;&lt;STRONG&gt;1269&lt;/STRONG&gt;&lt;/SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p4"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; no = &lt;SPAN class="s3"&gt;&lt;STRONG&gt;7725&lt;/STRONG&gt;&lt;/SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p4"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; f = na*log(p**&lt;SPAN class="s3"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/SPAN&gt; + &lt;SPAN class="s3"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/SPAN&gt;*p*(&lt;SPAN class="s3"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;-p-q)) + nb*log(q**&lt;SPAN class="s3"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/SPAN&gt; + &lt;SPAN class="s3"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/SPAN&gt;*p*(&lt;SPAN class="s3"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;-p-q)) + nab*log(&lt;SPAN class="s3"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/SPAN&gt;*p*q) + no*log((&lt;SPAN class="s3"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;-p-q)**&lt;SPAN class="s3"&gt;&lt;STRONG&gt;2&lt;/STRONG&gt;&lt;/SPAN&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p3"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;SPAN class="s2"&gt; &lt;/SPAN&gt;return&lt;SPAN class="s2"&gt;(f);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p3"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;finish&lt;SPAN class="s2"&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p4"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;con = { &lt;SPAN class="s3"&gt;&lt;STRONG&gt;0&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN class="s3"&gt;&lt;STRONG&gt;0&lt;/STRONG&gt;&lt;/SPAN&gt;, &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p4"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; &lt;SPAN class="s3"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN class="s3"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;};&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p4"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;probs = {&lt;SPAN class="s3"&gt;&lt;STRONG&gt;0.5&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN class="s3"&gt;&lt;STRONG&gt;0.5&lt;/STRONG&gt;&lt;/SPAN&gt;};&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p4"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;opt = {&lt;SPAN class="s3"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;, &lt;SPAN class="s3"&gt;&lt;STRONG&gt;4&lt;/STRONG&gt;&lt;/SPAN&gt;};&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p4"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;SPAN class="s1"&gt;call&lt;/SPAN&gt; nlpnra(rc, result, &lt;SPAN class="s4"&gt;"loglik"&lt;/SPAN&gt;, probs, opt, con);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #800000;"&gt;&lt;STRONG&gt;Here is the error that I get in the log:&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;283&amp;nbsp; call nlpnra(rc, result, "loglik", probs, opt, con);&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;ERROR: (execution) Invalid argument to function.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt; operation : LOG at line 271 column 90&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt; operands&amp;nbsp; : _TEM1025&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;_TEM1025&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 row&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 col&amp;nbsp;&amp;nbsp;&amp;nbsp; (numeric)&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt; statement : ASSIGN at line 271 column 5&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt; traceback : module LOGLIK at line 271 column 5&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;ERROR: (execution) Invalid argument to function.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt; operation : NLPNRA at line 283 column 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt; operands&amp;nbsp; : *LIT1019, probs, opt, con&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;*LIT1019&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 row&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 col&amp;nbsp;&amp;nbsp;&amp;nbsp; (character, size 6)&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt; loglik&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;probs&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 row&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2 cols&amp;nbsp;&amp;nbsp;&amp;nbsp; (numeric)&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0.5&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;opt&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2 rows&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1 col&amp;nbsp;&amp;nbsp;&amp;nbsp; (numeric)&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 4&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;con&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2 rows&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2 cols&amp;nbsp;&amp;nbsp;&amp;nbsp; (numeric)&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p2"&gt;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt; statement : CALL at line 283 column 1&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 May 2014 00:30:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-in-Using-NLPNRA-and-PROC-IML-for-Maximum-Likelihood/m-p/165533#M1602</guid>
      <dc:creator>EricCai</dc:creator>
      <dc:date>2014-05-20T00:30:29Z</dc:date>
    </item>
    <item>
      <title>Re: Error in Using NLPNRA and PROC IML for Maximum Likelihood Estimation</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-in-Using-NLPNRA-and-PROC-IML-for-Maximum-Likelihood/m-p/165534#M1603</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Because all of the NLP functions are similar, they are explained "all together" in the Chapter of the doc titled "Nonlinear Optimization Examples"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) The possible inputs are explained in the section "&lt;A href="http://support.sas.com/documentation/cdl/en/imlug/66845/HTML/default/viewer.htm#imlug_langref_sect264.htm"&gt;Nonlinear Optimization and Related Subroutines&lt;/A&gt;"&lt;/P&gt;&lt;P&gt;2) 'rc' stands for 'return code'. It is documented &lt;A href="http://support.sas.com/documentation/cdl/en/imlug/66845/HTML/default/viewer.htm#imlug_nonlinearoptexpls_sect009.htm"&gt;here&lt;/A&gt;. 'xr' stands for 'x result.' It is the optimum paramter found by the algorithm.&lt;/P&gt;&lt;P&gt;3) Your error is because the last term (log(1-p-q)) of the liklihood is undefined when p=q=0.5, which is your starting condition.&amp;nbsp; In fact, the term is undefined whenever p+q=1, so you probably want to constrain p+q&amp;lt;1.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 May 2014 01:15:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-in-Using-NLPNRA-and-PROC-IML-for-Maximum-Likelihood/m-p/165534#M1603</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2014-05-20T01:15:17Z</dc:date>
    </item>
    <item>
      <title>Re: Error in Using NLPNRA and PROC IML for Maximum Likelihood Estimation</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-in-Using-NLPNRA-and-PROC-IML-for-Maximum-Likelihood/m-p/165535#M1604</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your prompt reply, Rick! 1) After reading your comment and thinking really hard, I'm still struggling to translate the inequality p + q &amp;lt; 1 into that constraint matrix.&amp;nbsp; Could you please provide a hint? 2) I re-wrote the objective function into the likelihood (instead of the log-likelihood) so that there are no more logarithms.&amp;nbsp; f = (p**2 + 2*p*(1-p-q))**na + (q**2 + 2*p*(1-p-q))**nb + (2*p*q)**nab + ((1-p-q)**2)**no; I used the original constraint con = { 0 0,&amp;nbsp;&amp;nbsp; 1 1}; However, this method is problematic because of round-off error - each term is zero because a small number is exponentiated by a big number.&amp;nbsp; Is there any way to overcome this while still retaining the likelihood as the objective function? ***I now realize that the log-likelihood is better as the objective function for numerical purposes because of less round-off error. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 May 2014 02:33:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-in-Using-NLPNRA-and-PROC-IML-for-Maximum-Likelihood/m-p/165535#M1604</guid>
      <dc:creator>EricCai</dc:creator>
      <dc:date>2014-05-20T02:33:20Z</dc:date>
    </item>
    <item>
      <title>Re: Error in Using NLPNRA and PROC IML for Maximum Likelihood Estimation</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-in-Using-NLPNRA-and-PROC-IML-for-Maximum-Likelihood/m-p/165536#M1605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I always advise people to test their objective function before trying to optimize.&amp;nbsp; If you graph your objective function, you discover that the optimal value of your function is p=0.5 and q=epsilon&amp;gt;0. The function is undefined for q=0, so either there is no optimum in the interior or something is wrong with your function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I see in your comments that you are estimating the probability of alleles by using the Hardy-Weinberg equation.&amp;nbsp; By a happy coincidence, my son's teacher covered this a few weeks ago in his high-school biology class so I was able to look at your liklihood function and discover your error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The second term is incorrect.&amp;nbsp; The correct equation is&lt;/P&gt;&lt;P&gt;...+ nb*log(q**2 + 2* &lt;STRONG&gt;Q &lt;/STRONG&gt;*(1-p-q)) +...&lt;/P&gt;&lt;P&gt;If you change your equation, the NLP function finds an optimum in the interior of the feasible region:&lt;/P&gt;&lt;P&gt;p = 0.288 and q = 0.107. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 May 2014 15:59:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-in-Using-NLPNRA-and-PROC-IML-for-Maximum-Likelihood/m-p/165536#M1605</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2014-05-20T15:59:52Z</dc:date>
    </item>
    <item>
      <title>Re: Error in Using NLPNRA and PROC IML for Maximum Likelihood Estimation</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-in-Using-NLPNRA-and-PROC-IML-for-Maximum-Likelihood/m-p/165537#M1606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oops! I forgot to answer your question, which is necessary to obtain the answer:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; p&amp;nbsp;&amp;nbsp; q&amp;nbsp;&amp;nbsp; op&amp;nbsp;&amp;nbsp; rhs */&lt;/P&gt;&lt;P&gt;con = {0&amp;nbsp;&amp;nbsp; 0&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp; ,&amp;nbsp;&amp;nbsp;&amp;nbsp; /* min values&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp; ,&amp;nbsp;&amp;nbsp;&amp;nbsp; /* max values&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; 1&amp;nbsp;&amp;nbsp; -1&amp;nbsp;&amp;nbsp;&amp;nbsp; 1&amp;nbsp; };&amp;nbsp;&amp;nbsp;&amp;nbsp; /* 1*p + 1*q &amp;lt;= 1 */&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 May 2014 16:05:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-in-Using-NLPNRA-and-PROC-IML-for-Maximum-Likelihood/m-p/165537#M1606</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2014-05-20T16:05:54Z</dc:date>
    </item>
    <item>
      <title>Re: Error in Using NLPNRA and PROC IML for Maximum Likelihood Estimation</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-in-Using-NLPNRA-and-PROC-IML-for-Maximum-Likelihood/m-p/165538#M1607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rick!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) I'm sorry for wasting your time in deciphering what was wrong with my incorrectly coded objective function.&amp;nbsp; I should have caught that and double-checked that before asking for help.&amp;nbsp; Thanks for noticing it for me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) Yes, I should have plotted the objective function first.&amp;nbsp; I'm new to PROC IML, and I cannot find an example of a 3-dimensional plot on the web.&amp;nbsp; Could you please point me toward a useful resource to learn how to do it?&amp;nbsp; (I would prefer to try to figure it out on my own first before asking you for the code.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) Thanks for sharing the correct constraint matrix with me.&lt;/P&gt;&lt;P&gt;a) What does "op" mean for the name of the 3rd column?&amp;nbsp; (I'm guessing that "rhs" means "right-hand side", denoting the right-hand side of "p + q &amp;lt;= 1".)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;b) How did you come up with this constraint matrix?&amp;nbsp; Is there some resource that can teach me how to determine constraint matrices?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;c) What would be the constraint matrix for "p + q &amp;lt; 1"?&amp;nbsp; Would there be a difference between the "less than" and "less than or equal to"?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot for your help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Eric&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 May 2014 03:10:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-in-Using-NLPNRA-and-PROC-IML-for-Maximum-Likelihood/m-p/165538#M1607</guid>
      <dc:creator>EricCai</dc:creator>
      <dc:date>2014-05-21T03:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: Error in Using NLPNRA and PROC IML for Maximum Likelihood Estimation</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-in-Using-NLPNRA-and-PROC-IML-for-Maximum-Likelihood/m-p/165539#M1608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1) No worries. I often ask a colleague to look at a problem that I spent hours on, only to have him point out a mistake that was right before my eyes.&lt;/P&gt;&lt;P&gt;2) Check my blog for a dozen different examples. I prefer the contour plot, so search "contour plot" (include the quotes) at &lt;A href="http://blogs.sas.com/content/iml"&gt;http://blogs.sas.com/content/iml&lt;/A&gt;&amp;nbsp; I have examples of ODS plots and plots in SAS/IML Studio.&lt;/P&gt;&lt;P&gt;3) (b) Read the doc chapter &lt;A href="http://support.sas.com/documentation/cdl/en/imlug/66845/HTML/default/viewer.htm#imlug_nonlinearoptexpls_toc.htm"&gt;"Nonlinear Optimization Examples"&lt;/A&gt;, which tells you all about how to use the NLP functions. How to define the contraint matrix is in the section &lt;A href="http://support.sas.com/documentation/cdl/en/imlug/66845/HTML/default/viewer.htm#imlug_nonlinearoptexpls_sect015.htm"&gt;"Parameter Constraints"&lt;/A&gt;.&amp;nbsp;&amp;nbsp; (a) The 'op' column encodes the inequality: -1 means "less than or equal", 0 means "equal to", and +1 means "greater than or equal".&amp;nbsp; (c) In finite-precision arithmetic there is no "strictly less than", but you can define the RHS as (1 - 1e6) or (1 - 1e10).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 May 2014 13:05:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Error-in-Using-NLPNRA-and-PROC-IML-for-Maximum-Likelihood/m-p/165539#M1608</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2014-05-21T13:05:16Z</dc:date>
    </item>
  </channel>
</rss>

