BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Peter_Y
Calcite | Level 5

Hello:

I want to fit a repeated measure model using proc mixed but got confused by the appropriate way of writing down the model. Using the sample dataset pr in the SAS document

SAS/STAT(R) 9.2 User's Guide, Second Edition

The sample code in the above link proposes to use repeated statement directly

proc mixed data=pr method=ml covtest;

  class Person Gender;

  model y = Gender Age Gender*Age / s;

  repeated / type=un subject=Person r;

run;

which assumes measures within each subjects are correlated.  However, I have seen in many places that people use random effects to fit a repeated measure model. In this case, something like

proc mixed data=pr method=ml covtest;

  class Person Gender;

  model y = Gender Age Gender*Age / s;

  random person / v;

run;

The within subject correlation is modelled by introducing a random effect for each subject over different time point. The two model yields different results and I am not sure which one is correct. The data itself looks like a typical repeated measure without any special structure. If both models are valid (I bet they are), what are the assumptions in those two models and how can I decide which one to use if I am given a new dataset?

Thanks,

Peter

1 ACCEPTED SOLUTION

Accepted Solutions
SteveDenham
Jade | Level 19

Your first model assumes that measures within a person, at each time point, are related as expressed by the unstructured covariance matrix.  This R side formulation is the more standard approach, expecially for things like growth models (as the example given).  The G side model that you present ignores the correlation between time points, and calculates a variance component due to person.  This is sometimes referred to as a random intercept model.

You should look at SAS for Mixed Models, 2nd ed. by Littell et al, and at Generalized Linear Mixed Models by Stroup for some really good insights into model selection.

Steve Denham

View solution in original post

3 REPLIES 3
SteveDenham
Jade | Level 19

Your first model assumes that measures within a person, at each time point, are related as expressed by the unstructured covariance matrix.  This R side formulation is the more standard approach, expecially for things like growth models (as the example given).  The G side model that you present ignores the correlation between time points, and calculates a variance component due to person.  This is sometimes referred to as a random intercept model.

You should look at SAS for Mixed Models, 2nd ed. by Littell et al, and at Generalized Linear Mixed Models by Stroup for some really good insights into model selection.

Steve Denham

Peter_Y
Calcite | Level 5

Thanks Steve. I assume the first model is more general and would allow more general correlation structure whereas the second model enforces a positive within subject correlation.

SteveDenham
Jade | Level 19

I would call the second model more general, as it imposes no structure on the observations, assuming that they are randomly distributed, and that only the subject (person in this case) contributes variation above the residual variance.  The R side model (second model) enforces some sort of structure/correlation on the observations within a subject.

Steve Denham

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 3 replies
  • 2214 views
  • 0 likes
  • 2 in conversation