Dear community, I am trying to follow 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:
/*Define Density Function*/
data multivariate_data;
call streaminit(5);
%let theta1 = 5;
%Let theta3 = 3;
array Xi[2];
do i = 1 to 1000;
do j=1 to 2;
Xi[j]= rand('Bernoulli',.5);
end;
N=exp(&theta1*(Xi[1]+Xi[2])+&theta3*Xi[1]*Xi[2]);
D=(1+2*exp(&theta1)+exp(2*&theta1+&theta3));
P=N/D;
output;
end;
drop i j;
run;
proc print data= multivariate_data;
var P;
RUN;
proc iml;
use multivariate_data;
read all var {"Xi1","Xi2"} into x;
close multivariate_data;
/* write the log-likelihood function the distribution of interest */
start LogLik(param) global (x);
theta1 = param[1];
theta3 = param[2];
n = nrow(x);
return ( theta1*(sum(Xi1)+sum(Xi2)) + theta3*sum(Xi1)*sum(Xi2)-n*log(1+2*exp(theta1)+exp(2*theta1+theta3)) );
finish LogLik;
p = {2 4};/* initial guess for solution */
con = {., .}; /* Upper bounds for parameters (if any) */
optn = {1, /* find max of function */
3}; /* print a lot of output */
call nlpnra(rc,xres,"LogLik",p,optn,con);
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!