Programming the statistical procedures from SAS

Sas proc mixed - Repeated measures random effects

Reply
Occasional Contributor
Posts: 11

Sas proc mixed - Repeated measures random effects

I have a dataset in this format:

Capture.JPG

 

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.

PROC Star
PROC Star
Posts: 401

Re: Sas proc mixed - Repeated measures random effects

Posted in reply to stanmarciano

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;
run;

 

I hope this helps.

Occasional Contributor
Posts: 11

Re: Sas proc mixed - Repeated measures random effects

It does. Thank you so much.
Ask a Question
Discussion stats
  • 2 replies
  • 95 views
  • 1 like
  • 2 in conversation