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;

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.

  • 1
    $\begingroup$ You have only 9 observations and you are trying to estimate way more than 9 parameters. You need replications or a simpler model. $\endgroup$
    – Russ Lenth
    Jun 26, 2018 at 1:00
  • $\begingroup$ I have about 300 observations. The dataset was for reference. I should have mentioned that in the question. $\endgroup$
    – Prometheus
    Jun 26, 2018 at 3:45
  • 1
    $\begingroup$ Even so, it looks to me like the model you are trying to fit is too complicated for the data that you have. It isn't even clear to me exactly how you are trying to model this data. You have factor A and B as fixed effects with an interaction, but also as nested random effects? Factor B is nested in Factor A, and the interaction of Factor A and B is also somehow nested in Factor A? I am struggling to see how your specification of the random statement could be identified. $\endgroup$ Jun 26, 2018 at 13:27
  • 1
    $\begingroup$ Perhaps you should back up and be more clear about what your data is and what questions you are trying to answer with this model. Because I can't possibly see how such a random effects specification could make sense. $\endgroup$ Jun 26, 2018 at 13:29
  • $\begingroup$ @RyanSimmons Agreed. I should have more more clearer. I will add it after the required information at the end of my original question. Thanks a lot for your helpful comments. $\endgroup$
    – Prometheus
    Jun 26, 2018 at 15:13

1 Answer 1


I'd add a comment but I can't (not enough rep yet). Without looking at it in great detail, you have a coding error: for proc mixed, you specify fixed effects in the model statement, and you specify random effects in the random statement. If both factor A and factor B are some form of random effect, then your model line should simply be:

model DV = ;

Trying it out quickly appears to fix the error when I plug in your table and code.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.