I'm using proc glimmix to analyze calves born and calves weaned but it gives me the error: "Data did not converge" when I have a nested variable in the model statement for calves born. The data is almost exactly the same for calves born and calves weaned, both are 0s and 1s with only a slight difference in the total amount of each between the variables, but for some reason proc glimmix will only converge my data for calves weaned with a nested variable. The models are exactly the same except for the dependent variable. They are:
birthed_calfnum= f2_animal_breed cow_age(f2_animal_birth_year) / dist=binomial link=logit;
random f2_animal_id;
and
weaned_calfnum= f2_animal_breed cow_age(f2_animal_birth_year) / dist=binomial link=logit;
random f2_animal_id;
I've tried just running the model with the nested effect and upping the number of iterations but I still get the same error message. Does anyone have any idea what's going on and how to fix it? Thank you!
Please keep in mind each data set and model should be evaluated independently. Here are a few suggestions to try when you encounter the fail to converge message in the SAS LOG when using PROC GLIMMIX:
You can try some of the NLOPTIONS when you have convergence problems. For
example,
NLOPTIONS TECHNIQUE=NRRIDG; or NLOPTIONS TECH=NEWRAP;
and see if that helps your model to converge. Using NLOPTIONS=NRRIDG; for Binary, Binomial, Poisson, NegBin seems to help convergence.
If your variables or parameter estimates are of wildly different scales (like .0001 vs 100) then you may need to rescale your data or your model.
Try different starting values for your random effects by adding a PARMS statement.
You can also try adding the INITGLM option to the PROC GLIMIMX statement.
Examine the iteration history, does it look like it is making progress toward convergence. At the end (19 + 1initial optimizations is the default) if you are oh-so-close but do not quite make the convergence criteria. I would suggest that you increase the MAXOPT= in the PROC statement to 50 to see if your model converges. You can also increase the MAXITER= option on the NLOPTIONS statement to increase the number of iterations.
Try different METHODs= Laplace etc on PROC GLIMMIX statement such as METHOD=LAPLACE or QUAD if you are using SAS 9.2 or later for conditional model.
You may have to reconsider your model and simplify it. You may have to use simpler TYPE= structure as in your example TYPE=VC rather than TYPE=UN or you may have to reconsider the fixed effects.
Please keep in mind each data set and model should be evaluated independently. Here are a few suggestions to try when you encounter the fail to converge message in the SAS LOG when using PROC GLIMMIX:
You can try some of the NLOPTIONS when you have convergence problems. For
example,
NLOPTIONS TECHNIQUE=NRRIDG; or NLOPTIONS TECH=NEWRAP;
and see if that helps your model to converge. Using NLOPTIONS=NRRIDG; for Binary, Binomial, Poisson, NegBin seems to help convergence.
If your variables or parameter estimates are of wildly different scales (like .0001 vs 100) then you may need to rescale your data or your model.
Try different starting values for your random effects by adding a PARMS statement.
You can also try adding the INITGLM option to the PROC GLIMIMX statement.
Examine the iteration history, does it look like it is making progress toward convergence. At the end (19 + 1initial optimizations is the default) if you are oh-so-close but do not quite make the convergence criteria. I would suggest that you increase the MAXOPT= in the PROC statement to 50 to see if your model converges. You can also increase the MAXITER= option on the NLOPTIONS statement to increase the number of iterations.
Try different METHODs= Laplace etc on PROC GLIMMIX statement such as METHOD=LAPLACE or QUAD if you are using SAS 9.2 or later for conditional model.
You may have to reconsider your model and simplify it. You may have to use simpler TYPE= structure as in your example TYPE=VC rather than TYPE=UN or you may have to reconsider the fixed effects.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.