BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
tompatmck
Fluorite | Level 6

Hello, 

 

I'm analyzing data from a randomized complete block design at multiple sites across multiple years.  There are 4 blocks (1-4) at each site, so block is nested within each site (block(site)).  I am trying to run this as a simple mixed model and also as a repeated measures.  I would just like to know if my coding is correct for both.  Any insight would be appreciated.  Thanks.

 

A single year analysis to start :

proc mixed ;
class Site Block Treatment;
model biomass = Site|Treatment;
random Block(Site);
 run;

 

 

Multiple years without repeated statement.

Random terms:  block nested within site and then block*site*treatment to account for multiple observations across years.

proc mixed ;
class Year Site Block Treatment;
model biomass = Year|Site|Treatment;
random Block(Site)  Block*Site*Treatment;
 run;

 

Multiple years with repeated measures, but I'm unsure how to show that block is nested within each site (maybe the interaction accounts for this).

proc mixed ;
class Year Site Block Treatment;
model biomass = Year|Site|Treatment/ddfm=kr;
repeated Year / SUB= Site*Block*Treatment type=un ;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
SteveDenham
Jade | Level 19

these look good to me. My only suggestion would be on the multiple years without a repeated statement. Consider rewriting the RANDOM statement with block(site) as a subject. You would then have a random intercept and random slope model:

 

proc mixed ;
class Year Site Block Treatment;
model biomass = Year|Site|Treatment;
random intercept Treatment/subject=Block(Site) type=un;
 run;

I added type=un to handle any potential correlation between the intercept and Treatment.  This one does bother me a bit. I don't have an issue with a fixed effect being modeled as an R-side effect (repeated measures approach), but I think you will run into convergence and/or G matrix issues with Treatment as both random and fixed.

 

SteveDenham

 

 

View solution in original post

1 REPLY 1
SteveDenham
Jade | Level 19

these look good to me. My only suggestion would be on the multiple years without a repeated statement. Consider rewriting the RANDOM statement with block(site) as a subject. You would then have a random intercept and random slope model:

 

proc mixed ;
class Year Site Block Treatment;
model biomass = Year|Site|Treatment;
random intercept Treatment/subject=Block(Site) type=un;
 run;

I added type=un to handle any potential correlation between the intercept and Treatment.  This one does bother me a bit. I don't have an issue with a fixed effect being modeled as an R-side effect (repeated measures approach), but I think you will run into convergence and/or G matrix issues with Treatment as both random and fixed.

 

SteveDenham

 

 

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
  • 1 reply
  • 541 views
  • 1 like
  • 2 in conversation