I am writing an nlmixed procedure, and for the likelihood function, I want to use values generated with the iml procedure. So I am wondering if there is a way of using proc iml inside a proc nlmixed.
proc nlmixed data = xxx;
parms b0=0 b1=0;
mu = exp(b0 + b1*Age);
ll = log(((mu**y)*exp(-mu))/gamma(y+1));
model y~ general(ll);
run;
proc iml;
v = {5,6,7,8,9,10,11,12,13,14};
z = j(10,1,.);
do i = 1 to 6;
z[i] = ((v[i]-5)/5)*((mu**v[i])*exp(-mu))/gamma(v[i]+1);
end;
ll=log(sum(z));
quit;
The idea is to:
- use mu from
nlmixedinside theproc iml - but the ll from both steps should be inside
nlmixed