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

 

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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