<?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>roystriker77r Tracker</title>
    <link>https://communities.sas.com/kntur85557/tracker</link>
    <description>roystriker77r Tracker</description>
    <pubDate>Sun, 19 Apr 2026 06:29:48 GMT</pubDate>
    <dc:date>2026-04-19T06:29:48Z</dc:date>
    <item>
      <title>Error in using NLPNRA and PROC IML for MLE of a custom function</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/ERROR-in-using-NLPNRA-and-PROC-IML-for-MLE-of-custom-function/m-p/926383#M6206</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Dear community,&amp;nbsp; I am trying to follow&amp;nbsp;Rick Wicklin's example of using NLPNRA with PROC IML for maximum likelihood estimation. Unfortunately, I am encountering an error with NLPNRA. I am trying to use this script to find the MLE of a two parameter, two variable custome probability mass function:&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;/*Define Density Function*/&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;data multivariate_data;&lt;/DIV&gt;&lt;DIV&gt;call streaminit(5);&lt;/DIV&gt;&lt;DIV&gt;%let theta1 = 5;&lt;/DIV&gt;&lt;DIV&gt;%Let theta3 = 3;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;array Xi[2];&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; do i = 1 to 1000;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; do j=1 to 2;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Xi[j]= rand('Bernoulli',.5);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; end;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; N=exp(&amp;amp;theta1*(Xi[1]+Xi[2])+&amp;amp;theta3*Xi[1]*Xi[2]);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; D=(1+2*exp(&amp;amp;theta1)+exp(2*&amp;amp;theta1+&amp;amp;theta3));&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; P=N/D;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; output;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; end;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; drop i j;&lt;/DIV&gt;&lt;DIV&gt;run;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;proc print data= multivariate_data;&lt;/DIV&gt;&lt;DIV&gt;var P;&lt;/DIV&gt;&lt;DIV&gt;RUN;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;proc iml;&lt;/DIV&gt;&lt;DIV&gt;use multivariate_data;&lt;/DIV&gt;&lt;DIV&gt;read all var {"Xi1","Xi2"} into x;&lt;/DIV&gt;&lt;DIV&gt;close multivariate_data;&lt;/DIV&gt;&lt;DIV&gt;/* write the log-likelihood function the distribution of interest */&lt;/DIV&gt;&lt;DIV&gt;start LogLik(param) global (x);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;theta1 = param[1];&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;theta3 = param[2];&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;n = nrow(x);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp;return ( theta1*(sum(Xi1)+sum(Xi2)) + theta3*sum(Xi1)*sum(Xi2)-n*log(1+2*exp(theta1)+exp(2*theta1+theta3)) );&lt;/DIV&gt;&lt;DIV&gt;finish LogLik;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;p = {2 4};/* initial guess for solution */&lt;/DIV&gt;&lt;DIV&gt;con = {., .}; /* Upper bounds for parameters (if any) */&lt;/DIV&gt;&lt;DIV&gt;optn = {1,&amp;nbsp; /* find max of function&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;*/&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 3}; /* print a lot of output&amp;nbsp; &amp;nbsp; &amp;nbsp; */&lt;/DIV&gt;&lt;DIV&gt;call nlpnra(rc,xres,"LogLik",p,optn,con);&lt;/DIV&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;&lt;P&gt;&lt;SPAN&gt;However, after running this code I receive an error code following the nlpnra call that says error in argument BLC. After reviewing the documentation I thought that BLC was an option argument so I am confused as to why I am receiving this error. Anyt help would be much appreciated. Thanks!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 29 Apr 2024 19:45:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/ERROR-in-using-NLPNRA-and-PROC-IML-for-MLE-of-custom-function/m-p/926383#M6206</guid>
      <dc:creator>roystriker77r</dc:creator>
      <dc:date>2024-04-29T19:45:24Z</dc:date>
    </item>
    <item>
      <title>ERROR in using NLPNRA and PROC IML for MLE of custom function</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/ERROR-in-using-NLPNRA-and-PROC-IML-for-MLE-of-custom-function/m-p/926351#M6204</link>
      <description>&lt;P&gt;Dear community,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am trying to follow&amp;nbsp;&lt;/SPAN&gt;&lt;A href="http://blogs.sas.com/content/iml/2011/10/12/maximum-likelihood-estimation-in-sasiml/" target="_self" rel="nofollow noreferrer"&gt;Rick Wicklin's example of using NLPNRA with PROC IML for maximum likelihood estimation&lt;/A&gt;&lt;SPAN&gt;. Unfortunately, I am encountering an error with NLPNRA.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am trying to use this script to find the MLE of a two parameter, two variable custome probability mass function:&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;/*Define Density Function*/&lt;BR /&gt;&lt;BR /&gt;data multivariate_data;&lt;BR /&gt;call streaminit(5);&lt;BR /&gt;%let theta1 = 5;&lt;BR /&gt;%Let theta2 = 3;&lt;BR /&gt;	array Xi[2];&lt;BR /&gt;    do i = 1 to 1000;&lt;BR /&gt;        do j=1 to 2;&lt;BR /&gt;        Xi[j]= rand('Bernoulli',.5);&lt;BR /&gt;        end;&lt;BR /&gt;  	N=exp(&amp;amp;theta1*(Xi[1]+Xi[2])+&amp;amp;theta2*Xi[1]*Xi[2]); /*numerator of density function*/&lt;BR /&gt;  	D=(1+2*exp(&amp;amp;theta1)+exp(2*&amp;amp;theta1+&amp;amp;theta2)); /*denominator of density function*/&lt;BR /&gt;  	P=N/D;&lt;BR /&gt;        output;&lt;BR /&gt;        &lt;BR /&gt;    end;&lt;BR /&gt;    drop i j;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;proc print data= multivariate_data;&lt;BR /&gt;var P;&lt;BR /&gt;RUN;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;proc iml;&lt;BR /&gt;use multivariate_data;&lt;BR /&gt;read all var {"Xi1","Xi2"} into x;&lt;BR /&gt;close multivariate_data;&lt;BR /&gt;/* write the log-likelihood function the distribution of interest */&lt;BR /&gt;start LogLik(param) global (x);&lt;BR /&gt;   theta1 = param[1];&lt;BR /&gt;   theta2 = param[2];&lt;BR /&gt;   n = nrow(x);&lt;BR /&gt;   return ( theta1*(sum(Xi1)+sum(Xi2)) + theta2*sum(Xi1)*sum(Xi2)-n*log(1+2*exp(theta1)+exp(2*theta1+theta2)) );&lt;BR /&gt;finish LogLik;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;p = {2 4};/* initial guess for solution */&lt;BR /&gt;con = {., .}; /* Upper bounds for parameters (if any) */&lt;BR /&gt;optn = {1,  /* find max of function       */&lt;BR /&gt;        3}; /* print a lot of output      */&lt;BR /&gt;call nlpnra(rc,xres,"LogLik",p,optn,con);&lt;BR /&gt;&lt;BR /&gt;However, after running this code I receive an error code following the nlpnra call that says error in argument BLC. After reviewing the documentation I thought that&lt;BR /&gt;BLC was an option argument so I am confused as to why I am receiving this error. Anyt help would be much appreciated.&lt;BR /&gt;Thanks!&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 Apr 2024 17:42:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/ERROR-in-using-NLPNRA-and-PROC-IML-for-MLE-of-custom-function/m-p/926351#M6204</guid>
      <dc:creator>roystriker77r</dc:creator>
      <dc:date>2024-04-29T17:42:04Z</dc:date>
    </item>
  </channel>
</rss>

