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);
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.
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?