BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi there,

I have a 3-level growth model, where each patient has 3 waves of data recorded and the patients are nested within 6 hospitals. I should mention that my outcome is continuous. The patients were allocated to either of the two treatments available at each of the hospitals, and I am interested to see whether one treatment is better than another. I am assuming random intercepts and slopes as well as the unstructured covariance structure.
So this is what my model looks like in SAS:

proc mixed data=data covtest nobound;
class patientid hospital trt sex;
model outcome=time trt time*trt sex age/solution;
random intercept time/ type=UN sub=hospital;
random intercept time/ type=UN sub=patientid(hospital);
run;

My problem is that I keep getting a warning that the G matrix is non-positive definite. For the level 3 residuals I get negative variances for the intercepts and for the level 2 residuals I am getting both intercept and slope variances to be negative. I have tried FA(2) and some other covariance structures in the combination with 'parms' statement (which should also be ensuring that the G matrix is positive definite), but I still get the same problem.


Any suggestions would be greatly appreciated it. Thank you very much.
3 REPLIES 3
SteveDenham
Jade | Level 19
I believe the non-positive G is due to an overspecification of the random effects. After the fit of the patientid within hospital covariance structure, there is no variability "left" for the hospital only structure--the G matrix is linearly dependent. What occurs if you specify only patientid within hospital as a subject effect?

Steve Denham
SteveDenham
Jade | Level 19
More:

Perhaps the following will give what you are looking for:

proc mixed data=data covtest nobound;
class patientid hospital trt sex;
model outcome=time trt time*trt sex age/solution;
random hospital:
random intercept time/ type=UN sub=patientid(hospital);
run;

This would give a variance component due to hospitals, and would fit the random regression to the patients within each hospital. However, I cannot guarantee that the linear dependency is removed.

Steve Denham
deleted_user
Not applicable
Hi Steve,

Thanks for your comment. I've tried running the code you suggested but I'm still getting the slope variance to be negative......

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 933 views
  • 0 likes
  • 2 in conversation