Programming the statistical procedures from SAS

ANOVA with a random effect from clusters

Accepted Solution Solved
Reply
Super Contributor
Posts: 312
Accepted Solution

ANOVA with a random effect from clusters

[ Edited ]

For clustered data (multiple test sites from the same subject), if I want to do one way ANOVA to compare the baseline values in each group, is the followint the right way to add the random effect from clustering in the ANOVA model ?

 

proc glm 
data=mydata; class treatment subjid; model change = treatment;
random subjid; run;

Accepted Solutions
Solution
‎12-09-2016 10:41 AM
Valued Guide
Valued Guide
Posts: 673

Re: ANOVA with a random effect from clusters

You really (REALLY) don't want to use GLM for any situation with random effects. This was OK before procedures like MIXED and GLIMMIX were written, but GLM should be avoided now. For your example, use:

proc mixed data=mydata;
  class treatment subjid;
  model change = treatment;  
random subjid;
lsmeans treatment / diff;
run;

 

View solution in original post


All Replies
Solution
‎12-09-2016 10:41 AM
Valued Guide
Valued Guide
Posts: 673

Re: ANOVA with a random effect from clusters

You really (REALLY) don't want to use GLM for any situation with random effects. This was OK before procedures like MIXED and GLIMMIX were written, but GLM should be avoided now. For your example, use:

proc mixed data=mydata;
  class treatment subjid;
  model change = treatment;  
random subjid;
lsmeans treatment / diff;
run;

 

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 131 views
  • 3 likes
  • 2 in conversation