- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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