Programming the statistical procedures from SAS

Error: "Did not converge" in Proc mixed

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 19
Accepted Solution

Error: "Did not converge" in Proc mixed

Hello All,

I was trying to see the climate moisture trend over time for combined sites using proc mixed LMM.   However, when I tried to model it with the following command than an error occurred. It said "Did not converge."  I have applied the same model for temperature and it was successful. But not for climate moisture data. Please note that The climate moisture data have both negative and positive value. Can you please help me to solve the problem? Thanks. N.B access link to input data file https://www.dropbox.com/s/cgaws9lf7p5tkr1/cmi.xlsx?dl=0

 proc mixed data= import;
   class plot;
   model cmi =  plot plot*year;
run;

proc mixed data=import;
         class plot;
         model cmi = year /  ddfm=kr solution outp=pred;
         random int year / type=un subject=plot solution;
         run;

proc sort data=pred; 
         by year; 
         run;

      proc sgplot data=pred;  
         series y=pred x=year / group=plot;
         run;

Accepted Solutions
Solution
‎01-27-2016 01:34 PM
Valued Guide
Valued Guide
Posts: 679

Re: Error: "Did not converge" in Proc mixed

You can get this to converge in GLIMMIX (even with that extreme plot that was identified).


proc glimmix data=a ;
         class plot;
         model cmi = year /  ddfm=kr solution ;
         random int year / type=un subject=plot solution;
         run;

GLIMMIX uses a different optimization method by default than MIXED. Converges in 18 iterations. A nice thing about GLIMMIX, you can use the NLOPTIONS statement to specify other optimization methods (wasn't needed here).  To get output, use the OUTPUT statement (the out option on the model statement is not used in GLIMMIX).

 

If you look at the output, you will see that the UN(2,2) variance, the variance of slope, is basically 0. This results in missing values for standard errors of parameter estimates and the EBLUPS. Results suggest an overparameterized model for this response variable. You could reduce the random effect to a random intercept model.

View solution in original post


All Replies
Valued Guide
Valued Guide
Posts: 679

Re: Error: "Did not converge" in Proc mixed

There are many reasons for lack of convergence. You might be getting close before the iteration limit is reached. Suggest you add these options to the procedure statement:

           maxiter=1000 maxfunc=1000

You should look at the iteration history to see if the algorithm is getting close to convergence, but is jumping around a lot in terms of the "objective". You could see if convergence is achieved if you relax theconvergence criterion to

     convg=1e-6

(the default is convg=1e-8). The latter is a bit dangerous, because you may not be at the optimum solution. But this can help in checking things out.

 

You are fitting a straight-line model to the data. If the moisture trend with year is not very straight, then convergence would also be an issue.

Solution
‎01-27-2016 01:34 PM
Valued Guide
Valued Guide
Posts: 679

Re: Error: "Did not converge" in Proc mixed

You can get this to converge in GLIMMIX (even with that extreme plot that was identified).


proc glimmix data=a ;
         class plot;
         model cmi = year /  ddfm=kr solution ;
         random int year / type=un subject=plot solution;
         run;

GLIMMIX uses a different optimization method by default than MIXED. Converges in 18 iterations. A nice thing about GLIMMIX, you can use the NLOPTIONS statement to specify other optimization methods (wasn't needed here).  To get output, use the OUTPUT statement (the out option on the model statement is not used in GLIMMIX).

 

If you look at the output, you will see that the UN(2,2) variance, the variance of slope, is basically 0. This results in missing values for standard errors of parameter estimates and the EBLUPS. Results suggest an overparameterized model for this response variable. You could reduce the random effect to a random intercept model.

Grand Advisor
Posts: 10,050

Re: Error: "Did not converge" in Proc mixed

[ Edited ]

Your data for Plot 78p1 is has a much larger range of data than the others. The model will converge when that plot is dropped from the analysis.

The MEANS Procedure

                    Analysis Variable : cmi

               N
plot         Obs         Maximum         Minimum         Std Dev

370p1         65       7.4853610      -2.2740591       2.1793967

591p1         65       5.3872819      -3.0432296       2.0862358

594p1         65       4.4959485      -3.6916214       1.7677325

608p1         65       9.0713372      -2.3283802       2.3539313

609p1         65       6.8631951      -3.3686982       1.9735248

610p1         65       6.5983618      -4.1104316       1.9757973

612p1         65       9.4677688      -2.5632169       2.5307261

613p1         65       3.6177264      -3.9495914       1.7285168

614p1         65      11.0386928      -1.1157220       2.7113059

615p1         65       3.3356982      -3.1275722       1.5254858

616p1         65       3.3269424      -3.2875238       1.5755983

618p1         65       3.4038994      -3.7400507       1.6946378

621p1         65       2.3974877      -3.6640138       1.4707218

622p1         65       6.2530576      -3.8531421       2.3320447

625p1         65       3.1951359      -4.0699301       1.7616092

626p1         65       7.8543502      -4.4866951       2.3123009

78p1          65      29.5117128     -39.5160676      15.9697975

 

Occasional Contributor
Posts: 19

Re: Error: "Did not converge" in Proc mixed

Thanks
New User
Posts: 1

Re: Error: "Did not converge" in Proc mixed

You can try to proc sort your dependent variable.

 

 

proc sort data = import;
by cmi;
run;
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 2034 views
  • 3 likes
  • 4 in conversation