Search code examples
sasmixed-modelsrandom-effects

SAS proc mixed Degree of freedom error


I have a dataset in this format:

enter image description here

Factor A is a between subject factor (with 2 levels - High and Low). Factor B is a within subject factor (with 3 levels - High , Moderate and Low).

I want to run a mixed model with nested random effects factor.

The code that I am using is:

proc mixed data=data.mydata;
class FactorA FactorB;
model DV = FactorA|FactorB;
random FactorB(FactorA) FactorB*FactorA(FactorA);
lsmeans FactorA|FactorB;
run;

The log states: Estimated G matrix is not positive definite. I also do not get any of the p-values (only a '.' is displayed).

Furthermore in the output tables, I see that DF = 0. I have a hunch that this is what is symptomatic of the error. But I have been unable to figure out why this is happening. Any leads will be appreciated. Thanks.


Solution

  • According to SAS documentation:

    The Estimated G matrix not positive definite message usually indicates that one or more variance components on the RANDOM statement is/are estimated to be zero and could/should be removed from the model.

    I would suggest you start with a simpler random statement, perhaps just with intercept and gradually add effects (first main before considering interactions).

    As for the degree of freedom, knowing that the default ddfm for a model with random statement is contain which requires large sample size, I would suggest you try other methods like KR or SAT.

    Once your models are yielding results you can then go ahead and modify the model according to your preferences based on the data you have.