SAS author's tip: %NLINMIX macro tips


This week's %NLINMIX macro tips come from the esteemed authors of SAS for Mixed Models, Second Edition. Ramon C. Littell, George A. Milliken, Walter W. Stroup, Russell D. Wolfinger, and Oliver Schabenberger combined their expertise to write this indispensable guide. This 800 page book has made a big impact in the user community and received lots of praise--including this comment from Professor David A. Dickey: "It is hard to imagine anyone claiming to be a modern professional data analyst without knowledge of the methods presented in this book." You can read more user reviews here.

If you like this topic and this week's tip, I'd invite you to visit our Web catalog to read a free chapter from the book and the TOC.

The following excerpt is from SAS Press authors Ramon C. Littell, George A.  Milliken,  Walter W. Stroup, Russell D. Wolfinger, Oliver Schabenberger and their book "SAS for Mixed Models, Second Edition" Copyright © 2006, SAS Institute Inc., Cary, North Carolina, USA. ALL RIGHTS RESERVED. (please note that results may vary depending on your version of SAS software)

15.10.3  %NLINMIX Macro Tips

Although %NLINMIX attempts to recover from errors when possible, you may encounter cases where it exits abnormally. Because of its great flexibility, the SAS macro language is not always clear about precisely what causes execution errors. The following is a brief list of possible causes:

  • There is a syntax error in the %NLINMIX model specification in the form of missing or extra commas or semicolons.
  • The model specification is creating an error condition when computing derived variables.
  • There are unusual patterns of missing values in the data set.
  • The input data set is not sorted by subject.

If %NLINMIX fails to converge, double-check your MODEL= and DERIVS= (if you have any) specifications. Models that do not reasonably explain a data set are often difficult to fit to that data. Data with outliers can also cause problems.

If you feel that your model should be converging but it is not, the following suggestions may help:

  • Rescale the data and model so that all parameters are of the same order of magnitude. This can improve the stability of the algorithms.
  • If the convergence criterion appears to be descending nicely, you may only need to increase the maximum number of iterations using the MAXIT= option.
  • Try different starting values, possibly those from EXPAND=ZERO if you are using EXPAND=EBLUP.
  • Skip the initial PROC NLIN step by using OPTIONS=SKIPNLIN.
  • If you are not specifying your own derivatives, use the TOL= option, which may help in computing them more accurately.
  • If the PROC MIXED call itself is not converging, try the RIDGE= option. This option allows you to change the minimum initial ridge value applied to Hessian matrices, which are not positive definite. The default is 0.3145, and lowering it to 1E–3 or 1E–6 often works well.
  • If you are using EXPAND=EBLUP, the GAUSS=, MAXSUBIT=, FRACTION=, and SUBCONV= options request %NLINMIX to take extra Gauss-Newton steps within each iteration. Using these can help you achieve and speed convergence. They are documented as a part of the header portion of the macro.

About Author

Shelly Goodin

Social Media Specialist, SAS Publications

Shelly Goodin is SAS Publications' social media marketer and the editor of "SAS Publishing News". She’s worked in the publishing industry for over thirteen years, including seven years at SAS, and enjoys creating opportunities for fans of SAS and JMP software to get to know SAS Publications' many offerings and authors.

1 Comment

  1. Ikwuoche John David on

    I can't run %NLINMIX on SAS 9.4. This is a big issue for me as regards to my PhD thesis. I want to analyze my Split plot design data set which I modeled using 5 different nonlinear functions. Proc NLMIX can only handle maximum likelihood estimation but can't for REML. I am comparing the variances (WP & SP variances) based on ANOVA, ML and REML estimates. Then compare the OLS and EGLS for each models. I don't have a lower version of SAS to work with for %NLINMIX to run. How do I go about this?

Back to Top