Hello All,
I am working with a fertilizer study in apple tree production and I am hoping to get some help regarding my code.
Experimental Design:
My main interest is in differences per treatments, but I would also like to see how they are affected by time. I have gone back and forth on the code, specifically regarding the random and repeated statements. In my latest edition, I am using proc mixed and the code is as follows:
proc mixed;
class row trt tree year;
model yield = year trt trt*year/ddfm=kr2;
random intercept/subject=row;
random intercept/subject=row*trt;
random intercept/subject=row*trt*tree;
repeated year/subject=row*trt*tree type=ar(1);
lsmeans trt/adjust=tukey;
run;
My main question is, what subjects should I include in my random and repeated statements? I believe I should account for differences within blocks and experimental units, but do I also need to include variance within observational units (row*trt*tree)?
I have also attached the dataset and sas code. I would appreciate any insight.
Thank you!
Eliott
Each RANDOM statement correlates the observations from the same level of the subject effect. So your first RANDOM statement correlates observations from the same level of ROW. Your 2nd correlates observations from the same level of ROW*TRT, and so on. You *might* get more efficiency out of MIXED if you combine the three RANDOM statements into one, using
random int trt trt*tree / subject=row;
The REPEATED statement further calculates the observations from the same TREE in a ROW*TRT combination using AR(1) across the years.
If this is what you want, then you have the correct model. It can be informative to use the V and R options on the RANDOM and REPEATED statements respectively to see the correlation structure you have imposed on your data through your model. Use the syntax V= and R= to print only the portion of V or R for a certain subject level. For example, R=5 prints the block of R for the 5th subject.
Each RANDOM statement correlates the observations from the same level of the subject effect. So your first RANDOM statement correlates observations from the same level of ROW. Your 2nd correlates observations from the same level of ROW*TRT, and so on. You *might* get more efficiency out of MIXED if you combine the three RANDOM statements into one, using
random int trt trt*tree / subject=row;
The REPEATED statement further calculates the observations from the same TREE in a ROW*TRT combination using AR(1) across the years.
If this is what you want, then you have the correct model. It can be informative to use the V and R options on the RANDOM and REPEATED statements respectively to see the correlation structure you have imposed on your data through your model. Use the syntax V= and R= to print only the portion of V or R for a certain subject level. For example, R=5 prints the block of R for the 5th subject.
Thank you so much!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.