BookmarkSubscribeRSS Feed
Fluorite | Level 6

I have a dataset in this format:



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.

Rhodochrosite | Level 12 sld
Rhodochrosite | Level 12

It is important, I'd say critical, to distinguish between fixed effects factors (like your Factors A and B) and random effects factors (like ID). The novice mixed modeler often sees Factor A and ID as being the same thing and serving the same purpose in the specification of the model. But they are not the same thing--which is easy to see when you consider Factor A as having 2 levels, and factor ID as having (2 times the number of replications) levels; if nothing else, factors with different levels are different factors. Clarity in your thinking will lead to clarity in your model. I highly recommend studying SAS® for Mixed Models, Second Edition.


Meanwhile, if your design is a split-plot design, consider this code:


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


I hope this helps.

Fluorite | Level 6
It does. Thank you so much.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 2 replies
  • 1 like
  • 2 in conversation