BookmarkSubscribeRSS Feed
wy_CA
Calcite | Level 5
Could somebody please tell me what I did wrong? Thanks.

I am trying to get MLE for exponential duration model using NLPNRA in proc IML. I followed the example of Rosenbrock function in SAS/IML software reference. I got the error message "ERROR: (execution) Matrix has not been set to a value." exp is the data set imported. t is the variable in the data set that are the random numbers generated from an exponential distribution.


%macro test(dsn=,x=);
proc iml;
reset noname;
use &dsn;
read all var {&x} into tt;
print tt;

start LL(beta);
f=sum(log(beta)-beta*tt);
return(f);
finish LL;

start grad(beta);
g=j(1,1,0);
g=sum(1/beta-tt);
return(g);
finish grad;

start hess(beta);
h=j(1,1,0);
h=-100/(beta*beta);
return(h);
finish hess;

beta=1;
call NLPNRA(rc,xr,"LL",beta)grd="grad" hes="hess";
%mend;

%test(dsn=exp,x=t);
1 REPLY 1
Hutch_sas
SAS Employee
The matrix tt is unintialized in your gradient function grad(). In order for the global variable tt to be used in grad(), you need:

start grad(beta) global(tt);

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 1 reply
  • 970 views
  • 0 likes
  • 2 in conversation