BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Hi-Ho-Cherry-O
Calcite | Level 5

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:

  • RCBD with 4 blocks (rows)
  • 3 trees per plot (row*trt)
  • 5 Treatments (fertilizer rates) = (0, 25, 50, 75, and 100 lbs N/acre)
  • Measured Yield per tree once every 3 years (2019-2021)

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

1 ACCEPTED SOLUTION

Accepted Solutions
StatsMan
SAS Super FREQ

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. 

View solution in original post

2 REPLIES 2
StatsMan
SAS Super FREQ

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. 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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