Statistical Procedures

Programming the statistical procedures from SAS
BookmarkSubscribeRSS Feed
kkutz
Calcite | Level 5

Hello,

 

I am running into an issue with my mixed model, where the addition of the SOLUTION option in the random statement of PROC MIXED drastically affects the fixed effects estimates. Below is the model:

 

proc mixed data=eff method=REML;
by trtgrpn trtgrp;
class TRTPN (ref=first) USUBJID STRATAR;
model AVAL = TRTPN BASE avisitn TIMEK avisitn*TRTPN TIMEK*TRTPN STRATAR / solution ddfm=kr alpha=0.05 cl;
random INT avisitn TIMEK / sub=USUBJID type=un v;

estimate "Acute Slope, No Response" avisitn 52 avisitn*TRTPN 0 52 / e cl;
estimate "Acute Slope, Response" avisitn 52 avisitn*TRTPN 52 0/ e cl;
estimate "Chronic Slope, No Response" avisitn 52 TIMEK 52 avisitn*TRTPN 0 52 TIMEK*TRTPN 0 52 / e cl;
estimate "Chronic Slope, Response" avisitn 52 TIMEK 52 avisitn*TRTPN 52 0 TIMEK*TRTPN 52 0 / e cl;
estimate "Difference, Chronic Slope" avisitn*TRTPN 52 -52 TIMEK*TRTPN 52 -52 / e cl;

run;

 

In the above model, TRTPN reflects No response vs response, STRATAR reflects a 4 level stratification variable, AVISITN reflects the categorical visit (Week 6 to Week 108), BASE is the baseline value, and TIMEK is the time from change point (Week 6). TRTGRP/TRTGRPN reflects a subgroup of 2 different treatments. The results from this model are as follows:

kkutz_0-1749242322131.png

If I include the S option in the RANDOM statement, the estimates/DF for TRTGRPN = 2 drastically change:

kkutz_1-1749242405479.pngkkutz_2-1749242483858.png

Any thoughts on why this might be occurring?

6 REPLIES 6
JackieJ_SAS
SAS Employee

Hello, It would be helpful if you could include your log and complete output. Thank you.

kkutz
Calcite | Level 5

Hello,

 

Thank you for your response. Below are the logs from the model with SOLUTION specified in the RANDOM statement and without:

 

Without:

kkutz_2-1749584930856.png

 

With:

kkutz_1-1749584821666.png

The logs appear identical. I attached PDFs of the output from each model. The results for TRTGRP = A are identical but are drastically different for TRTGRP = B.

 

 

 

Ksharp
Super User

I think you should firstly get rid of the following  message.

 

 

Ksharp_0-1749603609520.png

 

JackieJ_SAS
SAS Employee

Hi,
Thanks for the log and output. Let's call your two BY conditions 1A and 2B.  When you add the SOLUTION option on the RANDOM statement, I see in your output for 2B that the table "Covariance Parameter Estimates" stays the same, whereas the tables "Solutions for Fixed Effects" and "Estimates" change. It is puzzling that the estimates for the covariance parameters stay the same, but the estimates for fixed effects (which are functions of the covariance parms) change. Off hand, I don't know why adding the SOLUTION option on the RANDOM statement should change the model. Maybe the option changes the inverse matrix being used in estimates?

As @Ksharp mentioned, you do have numerical problems with your model that you should fix.  Here is a blog with some more information about the note "Estimated G matrix is not positive definite": Convergence in mixed models: When the estimated G matrix is not positive definite - The DO Loop

You do want to do something about a non-positive definite G matrix and don't want to continue with results where that is an issue. 

Some things you could try:
1) Remove one of AVISITN or TIMEK from the RANDOM statement. This reduces your covariance matrix to make it simpler. I vote for removing AVISITN, since it has a zero variance estimate in your 1A case.

2) Specify the NOBOUND option on the PROC MIXED statement to allow variance components to be allowed to be negative. I don't have a lot of experience with doing this.
3) Try forming your covariance structure with a REPEATED statement instead of a RANDOM statement. For example, you could try a spatial power covariance structure with TYPE=SP(POW)(TIMEK).
4) Run this model in PROC GLIMMIX instead of PROC MIXED. You'd need to remove the METHOD=REML option, but otherwise, I think your code should run without edits. I doubt that using GLIMMIX would do anything about your non-positive G matrix, but it might help with the fact that your output is changing when the SOLUTION option is added.


To really get to the bottom of this, I suggest you contact SAS tech support. Their help is included with your license:
SAS Technical Support | SAS Support

Ksharp
Super User

I am also curious. SOLUTION option of RANDOM statement is just printing out the mixed effect estimated coefficient, would not change its value .

Rick_SAS
SAS Super FREQ

Would you be willing to try an experiment that might help us diagnose the issue?

I would be very interested in knowing what happens if you use WHERE clauses instead of the BY statement. Could you try the following:

  1. Remove the BY statement.
  2. Add the following statement:
    WHERE trtgrpn=1 AND trtgrp='A';
  3. On the RANDOM statement, remove the SOLUTION option.
  4. Change the ODS OUTPUT statement to be
    ODS OUTPUT Estimates=Est_No_Soln;
  5. Run the procedure.
  6. On the RANDOM statement, specify the SOLUTION option.
  7. Change the ODS OUTPUT statement to be
    ODS OUTPUT Estimates=Est_Soln;
  8. Run the procedure.
  9. Compare the Est_no_Soln and Est_Soln datasets.

If you get different results, please use PROC PRINT to show both datasets.

If you do not get different results, please run the other three cases that are handled by the BY statement:

  • WHERE trtgrpn=1 AND trtgrp='B';
  • WHERE trtgrpn=2 AND trtgrp='A';
  • WHERE trtgrpn=2 AND trtgrp='B';

By getting rid of the BY statement, we can focus on the subset of the data that is causing the issue.

 

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 6 replies
  • 771 views
  • 3 likes
  • 4 in conversation