Programming the statistical procedures from SAS

Nested Models and PROC Mixed

Reply
New Contributor
Posts: 2

Nested Models and PROC Mixed

I am running a statistical analysis for an experiment where subjects were randomly selected.  A strength measurement was taken at the same two locations (location) for each participant. The strength measurement was taken twice with two different methods (method). So there are 4 measurements for each participant.  We would like to determine if gender impacts the strength.  To do this we ran the following model:


proc mixed data=set;

  class IDnum Sex method location;

  model strength =  Sex | method | location;

  random IDnum(Sex);

run;

The nested effect (IDnum(sex)) is considered to be random. But does this take into account the variability due to individuals themselves? Would I need to modify the random statement as follows:

random IDnum(Sex) IDnum;

Respected Advisor
Posts: 2,655

Re: Nested Models and PROC Mixed

This random term is the residual error for your design, and doesn't need to be explicitly stated in the random statement.  Now, if you consider location to be a repeated factor (which I would), then perhaps the following code would be appropriate:

proc mixed data=set;

  class IDnum Sex method location;

  model strength =  Sex | method | location;

repeated location/subject=IDnum(sex);

run;

This syntax for IDnum(sex) is necessary only if there are duplicate IDnum's that might be distinguished by sex (for instance, 101 in males, and 101 in females).  If IDnum is unique across sex, the syntax will work, but is not necessary.

The statement

random IDnum(Sex) IDnum;

will almost surely lead to a message that the 'G matrix is not positive definite' as it is redundant.

Steve Denham

New Contributor
Posts: 2

Re: Nested Models and PROC Mixed

Thank you Steve for responding to my question. It was very helpful.

Ask a Question
Discussion stats
  • 2 replies
  • 184 views
  • 4 likes
  • 2 in conversation