BookmarkSubscribeRSS Feed
alex2200
Calcite | Level 5

Hi

I am elementary user of sas, my experiment was 2 years agricultural experiment.

The experiment was laid out in the factorial split-plot arrangement based on a randomized complete block (RCB).

I can analysis of this experiment in one year by sas.

I know the script ( code) of it in sas:

"

data;
input a b c block y1;
cards;
;

proc anova;
classes block a b c;
model y1=block a b a*b block(a b) c a*c b*c a*b*c;
test h=a e=block(a b);
test h=b e=block(a b);
test h=a*b e=block(a b);
means a/duncan alpha=0.01 e=block(a b);
means b/duncan alpha=0.01 e=block(a b);
means c/duncan alpha=0.01;
means a*b a*c b*c a*b*c;
run;quit;

"

But my problem is the combine of 2 years.

does any body know the script ( code ) of it? can any body help me?

20 REPLIES 20
alex2200
Calcite | Level 5

please help me ! it is so important for me.  I googled it in internet . also I have been read all of my statistics books. but I could not find appropriate answer.

please help me

SteveDenham
Jade | Level 19

Hi Alex,

Let me ask some questions first.  When you say two years--are the treatments (a b c) applied to the same plots in both years?  If so, then it could be addressed as a repeated measures design.  If not, then you will need to decide whether to consider year as a fixed effect or a random effect.  With only two years worth of data, it is probably more appropriate to consider it as a fixed effect, giving rise to a split-split plot design.  One thing of great importance is that PROC ANOVA and PROC GLM do not correctly calculate standard errors of factors in a split-plot design (see SAS System for Mixed Models by Littell et al., either edition).  This reference has an entire chapter on fitting models to split-plot designs.

With an answer to the question above about design, we can adapt your code to PROC MIXED and obtain a more appropriate analysis.

Steve Denham

alex2200
Calcite | Level 5

thank you very much indeed for your answer SteveDenham.

yes  the treatments was applied to the same plots in both year , so I think, it can addressed as a repeated measures design.

I heard about proc anova and proc glm which they do not work correctly in split plot design, but  in some references and Class notes anova and proc glm was used for analysis split plot design for one year expriment.  the question is that: does that  not work correctly for one year analysis? or it doses not work correctly for 2 years combine just?

thank you again

lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12

GLM and ANOVA procs are always wrong for split-plots.

alex2200
Calcite | Level 5

ok! I accept that Smiley Happy

so could any body help me about PROC MIXED code of one year and combine of 2 years?

lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12

You need to better explain your design. Do you have a, b, and c, plus year, or is year one of the letters in your code? A split plot would normally have two fixed effect factors, not three. It looks like you have two factors crossed at the higher level (a and b), and then c is the sub-plot (within the axb combination). Is this right?

alex2200
Calcite | Level 5

thank you for answer lvm

ok I explain my design:

The experiment was laid out in the factorial split-plot arrangement based on a randomized complete block (RCB).

we had 3 factor

A , B and C

factor A had 3 treatments

factor B had 2 treatments

factor c had 2 treatments

factor a and b were in main plot ( factorial)

and factor c was in sub plot ( split plot)

( so I think you say right lVm)

we had 4 replication

the year is not one of the letter in code. and all of  the factors (A and B and c)  is agricultural factor.

I want the:

1. code of analyses of one year

2. the cod of analysis of combined experiments ( 2 year)

in PROC MIXED( please).

It would be appreciated if you could help me

lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12

Here is the mixed code for one year (split plot with two whole plots).

proc mixed;

classes block a b c;

model y1=  a|b|c ;

random block block(a b);

lsmeans a|b|c / alpha=0.01 diff adjust=simulate ;

run;

Random effects are only listed in a random statement. All the tests are conducted correctly and automatically (no TEST statements, etc.). See how easy it is. Duncan adjustments are not available, and are not recommended. I put in simulation adjustment, which is now considered a good choice.

I actually think you should use a Kenward-Roger df adjustment also. Change model statement to:

model y1=  a|b|c / ddfm=kr ;

Now, we can consider year to be a repeated measure within the block*a*b*c experimental units (you said the same plot is observed for each year). I consider year to be a fixed effect. With only two years, the covariance structure has limited structure, so we can consider compound symmetry. This is the same then as a split-split plot with blocks. I doubt if you want all the interactions with year (you will never be able to interpret all the 2x,3x, and the 4x interaction). But I will write the model (one possibility) with the four way interaction:

proc mixed;

classes block a b c year;

model y1=  a|b|c|year / ddfm=kr ;

random block block(a b) block(a b c);

lsmeans a|b|c / alpha=0.01 diff adjust=simulate ;

*you can add more LSMEANS statements here, say for specific year interactions;

run;

The above assumes that the data are stacked, with a year variable added and a separate record for each year.

If you had more than two times, you must consider more complex covariance structures. A more general approach for any number of times for the repeated measure is to use:

proc mixed;

classes block a b c year;

model y1=  a|b|c|year / ddfm=kr ;

random block block(a b) ;

repeated year / subject=block*a*b*c  type=ar(1) ; *there are many choices for type;

lsmeans a|b|c / alpha=0.01 diff adjust=simulate;

*you can add more LSMEANS statements here, say for specific year interactions;

run;

or

proc mixed;

classes block a b c year;

model y1=  a|b|c|year / ddfm=kr ;

random block block(a b) random block(a b c) ;

repeated year / subject=block*a*b*c  type=ar(1) ;

lsmeans a|b|c / alpha=0.01 diff adjust=simulate;

*you can add more LSMEANS statements here, say for specific year interactions;

run;

I expect that some variance components will be 0. One approach is to then remove them.

Herwibawa
Calcite | Level 5

Hi,

I'm elementary user of sas and was working on split plot design and it will then be followed by Duncan Multiple Range Test. Please kindly help me to correct my sintax :

data Yield;

  input A $ B $ Block Yield;

  treatment = K||X;

cards;

K1 X1 2 7

;

proc anova data=Yield;

  class Block A B;

  model Yield=A B A(Block) B A*B;

  means A B A*B / duncan e=A(Block);

run;

proc anova data=Yield;

class treatment Block;

model Yield=treatment Block;

means treatment/duncan;

run;

SteveDenham
Jade | Level 19

Use the code that was provided by @lvm, with minor changes as needed.  Note that PROC ANOVA and PROC GLM do NOT correctly analyze split-plot designs.

Also, seriously consider ad different adjustment method than Duncan's New Multiple Range Test.  It is neither new nor truly a multiple range adjustment.  There is extensive literature in this area, and better options are outlined in the LSMEANS documentation.

Steve Denham

lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12

Never, ever, use PROC ANOVA or PROC GLM for split plots, Standard errors will be wrong. Use MIXED or GLIMMIX. The later are much easier anyway: by specifying random effects, the procedure knows how to do each appropriate test. Here is code assuming that A is the whole plot and B is the subplot.

proc glimmix data =  ;

class block A B;

model yield = A|B;

random block A*block

lsmeans A B A*B / diff adjust=simulate;

run;

Duncan multiple range is definitely out of favor, and can't be done with MIXED or GLIMMIX. I personally recommend adjust=simulate (fewer unrealistic assumptions).

Herwibawa
Calcite | Level 5

A very big thank you both @SteveDenham and @lvm for your advices. I have just revised my codes, and could then you want to help to correct my codes below. However, how to compare each treatment to others ? meanwhile I can't use Duncan in Proc Mixed, can you ? If so, I propose to use "adjust = DUNNET" to compare with control, am I wrong ? but I didn't understand how to interpret it in my paper with a,b,c, notation, it's looked very different results of "means A B A*B / DUNCAN e=A(Block)" in Proc Anova. Please help me...


data sp;

  input A $ B $ Block Y;

  datalines;

A1 B1 1  72

A1 B1 2  63

A1 B2 1  45

A1 B2 2  30

A1 B3 1  4 

A1 B3 2  7

A2 B1 1  23 

A2 B1 2  27

A2 B2 1  85

A2 B2 2  65

A2 B3 1  55 

A2 B3 2  58

A3 B1 1  5

A3 B1 2  8

A3 B2 1  23 

A3 B2 2  21

A3 B3 1  15 

A3 B3 2  19

A4 B1 1  30

A4 B1 2  39

A4 B2 1  42 

A4 B2 2  44

A4 B3 1  12 

A4 B3 2  18

;

proc mixed;

   class A B Block;

   model Y = A B A*B;

   random Block A*Block;

   lsmeans A|B / adjust=DUNNETT;

run;

lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12

Remember, don't try comparing your results to the ANOVA output. The latter will be wrong for several parts of the mean comparisons! I am not sure what you are asking; it is fine to use the dunnett method, but be careful, SAS is deciding on the level of the factors to use as the control (the default is the first level of A and the first level of B). This can be altered with diff= option. Not sure what you mean about letters. I am guessing you want to see a table of means followed by mean separation letters. This is only done when all combinations of means are compared, not just with the control. You can do this with GLIMMIX, not MIXED, using the LINES option on the LSMEANS statement (as long as you use an adjustment that gives all mean comparisons). The code below does this. Note that you have a significant interaction, and the multiple comparison table is for theinteractions. However, most would argue that you would want to restrict comparisons to all levels of A at each level of B, or all levels of B at each level of A (the so-called simple effects). To get this, add the line:

slice A*B / sliceby=B adjust=simulate lines;

to get the simple effects for each level of B (as an example).

proc glimmix;

   class A B Block;

   model Y = A B A*B;

   random Block A*Block;

   lsmeans A|B / adjust=simulate lines;

  run;

Herwibawa
Calcite | Level 5

Thank you very much @lvm for your advices, I had tried to add the line :

proc glimmix;

   class A B Block;

   model Y = A B A*B;

   random Block A*Block;

   lsmeans A|B / adjust=simulate lines;

  run;

But, It didn't work on my SAS software, since I was using SAS 9.1. So, I revised the line :

proc mixed;

   class A B Block;

   model Y = A B A*B;

   random Block A*Block;

   lsmeans A B A*B / adjust=simulate;

  run;

The result of  "lsmeans A B A*B / adjust=simulate;" is attached below :

http://s24.postimg.org/jkl2xcdxh/image.jpg 

(be sorry I fell to insert an image)

However, I haven't understood yet how to interpret or read the result of "Lsmeans" on the image above ? so I can get a similar explain of "Interaction A*B", while it should be more easy to read when I analyzed using Duncan to get A B C notation some like on the image below.

http://s12.postimg.org/gvn43353h/image.jpg

Please help me it is so important for me...

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
  • 20 replies
  • 7492 views
  • 14 likes
  • 5 in conversation