BookmarkSubscribeRSS Feed
Emma_at_SAS
Lapis Lazuli | Level 10

I have a data set with 3 measurements on each subject and a set of covariates. When I run PROC MIXED for my regression analysis again, it creates different regression coefficients that are sometimes slightly different but sometimes more different. I mean some significant factors change to nonsignificant or vice versa. Also, the model sometimes converges and sometimes does not. Any thoughts? 

 

proc mixed data=long;
class A (ref='1') B (ref='a') C (ref='a') D (ref='a') G (ref='a') ;
model Y=A B C D G / solution cl;
repeated repeated_order/subject=unique_ID type=AR(1);
lsmeans repeated_order A B C D G /diff cl;
run;
 
Thank you!
31 REPLIES 31
PaigeMiller
Diamond | Level 26

When I run PROC MIXED for my regression analysis again, it creates different regression coefficients

 

Do you mean you run the EXACT SAME CODE each time, and the results differ?

--
Paige Miller
PaigeMiller
Diamond | Level 26

And you run the code on the exact same data set, which hasn't changed at all?

--
Paige Miller
Emma_at_SAS
Lapis Lazuli | Level 10

Yes! For example when I use a different TYPE for covariance structure, sometimes my model converges, and sometimes it does not!

I asked another friend to try the same data and same model, and our results are again different!

Rick_SAS
SAS Super FREQ

Search the program for the characters 'ran' (case insensitive) to see where the program is using the RAND or the older RANUNI/RANNOR functions. I suspect that the LONG data set is different each time you run the program.

Emma_at_SAS
Lapis Lazuli | Level 10
Rick_SAS, may you please provide more details on how I do that? I mean is it a search on the PROC MIXED overall, or in my model. Also, how the LONG data set may be different each time I run program?

Thank you!
Rick_SAS
SAS Super FREQ

Do a text search (CTRL+F) in the program window, or whatever text editor you are using to write the SAS program.

Emma_at_SAS
Lapis Lazuli | Level 10

Thank you, Paige Miller and Rick_SAS for your thoughts on my question. 

Rick_SAS, I did not include a random intercept in my model yet (if your question is about that). I am planning to do so though, once I have a better sense of what is going on in my model. 

Do you think it has anything with local minimized errors?

In some optimization methods there are local and overall minimum errors, I am not sure if this applies to my model.

 

SteveDenham
Jade | Level 19

You should expect changes in the output if you change the type of the covariance matrix.  There are multiple inversions of the full matrix involved, and changing the constraints on the parameters in parts of the matrix (the Z part, or the R part of the residuals) will result in different solution vectors.  While means might converge to a point solution, the standard errors and resulting tests of significance are going to be different due to those constraints.

 

SteveDenham

Emma_at_SAS
Lapis Lazuli | Level 10
Thank you, SteveDenham! My concern is why even with the same covariance structure my results are different. I get different results today than my results on Friday. I double-checked everything and I did not change anything. I restarted my computer, I got different results again!
Rick_SAS
SAS Super FREQ

Please post the complete SAS log from one of your runs. Seeing the program is the only way to identify why the data are different.

 

Emma_at_SAS
Lapis Lazuli | Level 10
Thank you Rick_SAS for your idea! I will post my SAS log...
Emma_at_SAS
Lapis Lazuli | Level 10
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
61
62 proc mixed data=long;
63 where this_var=0;
64 class Var_1 (ref='a') Var_2 (ref='a') Var_3 (ref='a')
64 ! Var_4 (ref='a') age_group ethnicity education
64 ! income Var_5 Var_6 
64 !Var_7 /ref=first;
65 model Var_Y=age_group ethnicity education income 
65 !  Var_1 Var_2 Var_3 Var_4 Var_5 Var_6 Var_7/ solution cl;
66 repeated VAr_1/subject=ID type=VC;
67 lsmeans age_group ethnicity education income  
67 ! Var_1 Var_2 Var_3 Var_4 Var_5 Var_6 Var_7/diff cl;
68 run;
 
WARNING: ODS graphics with more than 5000 points have been suppressed. Use the PLOTS(MAXPOINTS= ) option in the PROC MIXED
statement to change or override the cutoff.
NOTE: Convergence criteria met.
NOTE: PROCEDURE MIXED used (Total process time):
real time 30.76 seconds
cpu time 30.70 seconds
 
 
70
71 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
84

 

PaigeMiller
Diamond | Level 26

When providing logs for us, it is important to maintain the formatting of the log, which makes it more readable and more usable. The unformatted log you provided is difficult to read, and I generally don't bother.

 

To do this, copy the log as text and paste it into the window that appears when you click on the </> icon.

--
Paige Miller

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

What is ANOVA?

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.

Discussion stats
  • 31 replies
  • 1708 views
  • 8 likes
  • 6 in conversation