Programming the statistical procedures from SAS

SAS code proc mixed ?

Reply
New Contributor
Posts: 4

SAS code proc mixed ?

1. Consider a multi-year trial to compare 5 treatments. The treatments were observed in each of 3 years, randomized complete block design with 4 block was used. Both year and the block are random effects.


2. Consider a multi-location (4), multi-year (3) trial to compare 6 treatments. The treatments were observed at 4 locations and in each of 3 years, randomized complete block design with 4 block was used. Location, year and the block are random effects.


Could someone provide SAS code (proc mixed)?

Thanks

Occasional Contributor
Posts: 8

Re: SAS code proc mixed ?

You can perform your analysis as I described...

data EXPERIMENT_DATA;

input LOCATION YEAR BLOCK TREATMENT VARIABLE1;

cards;

1 1 1 1 10

1 1 1 2 10.5

1 2 2 1 11

1 2 2 2 12

2 1 1 1 10

2 1 1 2 13

2 2 2 1 12.5

2 2 2 2 13

3 1 1 1 13

3 1 1 2 15

3 2 2 1 13.5

3 2 2 2 17

4 1 1 1 18

4 1 1 2 19

4 2 2 1 10

4 2 2 2 21

;

title "With treatment as random";

proc mixed data=EXPERIMENT_DATA;

class LOCATION YEAR BLOCK TREATMENT;

model VARIABLE1=;

random LOCATION|YEAR|TREATMENT BLOCK(LOCATION)/solution;

run;

title "With treatment as fixed";

proc mixed data=EXPERIMENT_DATA;

class LOCATION YEAR BLOCK TREATMENT;

model VARIABLE1=TREATMENT;

random YEAR|LOCATION BLOCK(LOCATION)/solution;

run; title;

Mensagem editada por: Alysson SIlva

New Contributor
Posts: 4

Re: SAS code proc mixed ?

Thanks Sllva

Respected Advisor
Posts: 2,655

Re: SAS code proc mixed ?

One thing to consider is whether the same experimental units are observed over years. That is--are experimental units randomized to treatment and block, and then followed over time (REPEATED) or are they selected and randomized separately each year (in which case Alysson's code is what you need)?

Steve Denham

New Contributor
Posts: 4

Re: SAS code proc mixed ?

Dear Denham

1. It was the second case. They were selected and randomized separately each year. I got the code. Thanks

2. In case, if same experimental units are observed over years. Taking years as random. Would you provide me the code?

3. Another situation, if we take multiple observations from same experimental units in the same year or multiple years? For example, we grow some perennial fodder (Rhode grass)  and take multiple cuts (say 5) in year 1 and take 3 cuts in year 2. How we would handle this data considering year random and repeated measurements from same experimental units. Thanks

kind regards

Rizwan Maqbool  

Respected Advisor
Posts: 2,655

Re: SAS code proc mixed ?

In answer to 2:

proc mixed data=EXPERIMENT_DATA;

class LOCATION YEAR BLOCK TREATMENT;

model VARIABLE1=TREATMENT YEAR TREATMENT*YEAR;

random LOCATION BLOCK(LOCATION)/solution;

repeated YEAR/subject=block(location) type=ar(1); /*Note that other types may be used here, such as ARH(1) or UN.  Check each and select the one with the smallest corrected AIC*/

run;

In answer to 3:

Consider CUTTINGDAY as day post randomization to treatment on which the cutting is made.  You might want to try:

proc mixed data=EXPERIMENT_DATA;

class LOCATION YEAR BLOCK TREATMENT cuttingday;

model VARIABLE1=TREATMENT cuttingday cuttingday*treatment;

random YEAR|LOCATION BLOCK(LOCATION)/solution;

repeated cuttingday/subject=block*location*year type=sp(pow)(dayc);

/*Because the cutting days are almost assuredly unequally spaced in time the spatial power covariance structure is appropriate.  You will need to define dayc in the dataset EXPERIMENT_DATA as equal to cuttingday.  It is used as a continuous variable, rather than categorical.  Where this could get very complicated is that cuttingday is very likely to differ by year.  In that case, I would recommend moving to a radial smoothing analysis using PROC GLIMMIX, as in Example 44.6 of the SAS/STAT 13.2 documentation. */

run;

Good luck.

Steve Denham

New Contributor
Posts: 4

Re: SAS code proc mixed ?

Thank you  Denham for detailed response and suggestion for choosing correct covariance structure.

In agronomic studies, Multi-cuts of perennial fodders or leachates and soil extracts from lysimeter (multiple readings) data, we analyze it as repeated measures.

1. my question is could we analyze plant growth data (for example leaf area index or leaf area duration) as repeated measures. Suppose we have used same plants for multiple measurements. In case no, t then why?

2. Leaf area index (LAI) was measured at 45, 60, 75 and 90 days after sowing from a experiment laid out RCBD with 5 treatments. Could you possibly suggest statistical analysis that a) tells us trend over time b) could you suggest some graphs (e.g simple line graph with lettering)? 

Thanks

kind regards

Rizwan

Respected Advisor
Posts: 2,655

Re: SAS code proc mixed ?

At this point, I strongly recommend that you obtain a copy of SAS for Mixed Models, 2nd ed. by Littell et al., and Generalized Linear Mixed Models by Walt Stroup.  There are tons of examples there for the kind of questions you are asking.

Steve Denham

Ask a Question
Discussion stats
  • 7 replies
  • 1334 views
  • 6 likes
  • 3 in conversation