Hi there
I wanted to apply proc nlmixed on real data but I got this error: Execution error for observation 97.
Is there any body here to help me how to solve it?
Best wish
proc nlmixed data=data qpoints=10 gconv=1e-2;
bounds 0 <=sigma2;
/* Initail Values ---------------- */
parms a0=5.3 a1=1.3
b0=14.3 b1=0.01 b2=0.2 b3=2.5
g1=1.1 g2=-0.1 g3=0.5
sigma2=1
l1=1 l2=2 l3=3 k=0.01;
/* Log Likelihood ---------------- */
if t=0 then do;
lam = exp(g1*GENDER + g2*AGE +g3*CITY + l2*a + l3*b);
loglik=(censored=0)*(log(lam)-lam * time) + (censored=1)*(-lam * time);
end;
else do;
pi = 1/(1 + exp(-(a0 + a1*ADTYPE + a)));
eta = abs(k)**(-2);
mu = b0 + b1*ADTYPE +b2*AGE +b3*GENDER - log(pi)-sigma2*log(k**2)/k-lgamma(eta*(k+k*sigma2))+lgamma(eta) + l1*a + b;
u = sign(k)*(log(Y) - mu)/sigma2;
if Y=0 then loglik=log(1-pi);
else if Y>0 then loglik=log(pi)- lgamma(eta) + eta*log(eta) - log(sigma2) - log(Y) + u*sqrt(eta) - eta*exp(abs(k)*u);
else if Y = . then loglik=0;
end;
model ID ~ general(loglik);
random a b ~ normal([0,0], [1, 0, 1]) subject=ID;
run;
Typically, this means that the procedure can't perform the math. Example: you can't use the LOG() function on a negative number or a zero value.
You have the data.
You need to trace through the code using data from observation 97 to see where a problem could happen. I can't do that for you.
Hello @m_hojai82 and welcome to the SAS Support Communities!
@m_hojai82 wrote:
So where is the problem? In formula or initial parameters or both?
[and earlier:]
...u = sign(k)*(log(Y) - mu)/sigma2;
if Y=0 then ...
I guess the term log(Y) in the definition of u is a good candidate since you consider the case Y=0 immediately afterwards.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.