First, if this is a "very basic model" for you, then I'm not sure how much help I can offer, since it doesn't look basic to me! Second, I have to compliment you. You have clearly done your research. You are using NLPNRR to match the fact that PROC MIXED uses a ridge-stabilized Newton-Raphson algorithm. You are using the same ML formula in the PROC MIXED doc. So what is the source of the problem? I don't see anything obvious, but nonlinear optimization is complicated. The PROC MIXED documentation lists 14 different problems that can occur during the MLE, and many of those are general issues apply to general optimization problems. You say "that the model does not converge," but you don't give the reason. Does SAS report an error? (If so, what is it? Can you make the error go away by constraining sigma2>1e-8?) Is the gradient not zero at the final estimate (if so, allow more iterations or change the criteria that stop the algorithm). One specific suggestion: Take the solution that PROC MIXED gives and plug it into the log-likelihood function that you have define. Does your IML code give the same gradient and Hessian at that point as does PROC MIXED? If not, your function and PROC MIXED are computing different things. (The LL is only defined up to a constant, so the LL might not match.) A related suggestion: if you use the solution from PROC MIXED as an initial condition, does the IML code converge? If so, maybe the intial condition is bad. Rick PS. One small performance suggestion: You don't need a loop to eliminate the missing values. Use the LOC function to find the nonmissing values, then extract them. For example, I think your IF-THEN...DO WHILE code is equivalent to yobs = yi[loc(y^=.)]; For more on removing missing values, see http://blogs.sas.com/content/iml/2010/09/15/removing-observations-with-missing-values/
... View more