Thanks, Paul. I've had the same experience, but what was strange is that it wouldn't evaluate the functions within NLMIXED but would within a data step, even for the same values passed in the parms statement. The problem had something to do with the negative values that come from the normal component of the mixture. The estimation will run if I do not call the pdf('lognormal'...) function for negative data points and just replace this with zero (actually 1E-300) to avoid problems with the log function. I'm still not sure why the original code doesn't work, but this work-around should be fine. *Estimate the model;
proc nlmixed data=simdata fd=central technique=congra update=pb hessian;
parms a1 = -3.91, pi0=0.8, sigma0=0.005, sigma1=0.1245;
bounds 0 <= pi0 <= 1, 0 < sigma0, 0 < sigma1;
temp1= pi0*pdf('normal',x, 0, sqrt(sigma0**2));
temp2 = 0;
if x > 0 then temp2=(1-pi0)*pdf('lognormal',x, a1, sqrt(sigma1**2));
temp = temp1 + temp2;
if temp = 0 then temp = 1E-300;
loglik = log(temp);
pi1 = 1-pi0;
ln_mean = exp(a1+0.5*sigma1**2);
ln_sd = sqrt((exp(sigma1**2) - 1)*exp(2*a1 + sigma1**2));
model x~general(loglik);
estimate 'alpha1' a1;
estimate 'pi0' pi0;
estimate 'sigma0' sigma0;
estimate 'sigma1' sigma1;
estimate 'pi1' pi1;
estimate 'ln_mean' ln_mean;
estimate 'ln_sd' ln_sd;
run;
... View more