Factorial treatment designs are popular, due to advantages of research on multiple treatment factors and how they interact. But if the design includes a control treatment that is not part of the factorial, problems occur in estimation of least squares means. A typical example is shown here, with 2 fertilizer and 3 irrigation treatments, giving 6 factorial treatment combinations, plus a control that is defined by a 3rd level of fertilizer, and a 4th level of irrigation:
Fert1:Irrig2 Fert2:Irrig1 Fert1:Irrig1
Fert2:Irrig3 Fert1:Irrig3 Fert2:Irrig2 Control
Other situations might have the control sharing a level of one of the factors, for example the control might be defined as Fert2:Irrig4. But this still causes problems with estimation of least squares means due to the levels of one factor not occurring with all levels of the other factor.
Let's jump into a SAS example, but using random numbers to allow easy creation of the example data. This code creates 13 treatments, a 4 by 3 factorial plus a control, each tested in 3 blocks of a randomized block design.
data fake;
do block=1,2,3;
treatment='Control'; timing='control'; y=100 + 20*block + 10*rannor(46390); output;
do treatment='A','B','C','D';
do timing='early','mid','late';
y=100 + 20*block + 10*rannor(46390);
output;
end;end;end;
run;
If we run a standard mixed model ANOVA, you will see that all of the main effect means are missing. The control treatment creates a level that all of the other levels are missing, thus the means are undefined.
proc mixed data=fake;
class block treatment timing;
model y = treatment | timing;
random block;
lsmeans treatment | timing ;
run;
An academic solution is to change the model to
model y = treatment * timing;
which has the effect of analyzing just the 13 treatments, and then using contrast and estimate statements to extract the desired information. But imagine the difficulty, as there will be 3 contrasts to recreate the main effect and interaction tests of the ANOVA table, 7 estimates to get the main effect means, then 10+6 contrasts to compare the main effect means to each other if mean separation information is needed.
A simpler solution is to use the bylevel option, which requests that least squares means only average over the levels that exist. The code is
proc mixed data=fake;
class block treatment timing;
model y = treatment | timing;
random block;
lsmeans treatment | timing / bylevel ;
run;
and you now see all means being estimated, and the ANOVA has the expected factorial DF. We can verify that the means are averaged over the expected treatments by requesting raw means, and find them identical.
proc means data=fake; ways 1 2;
class treatment timing;
var y;
run;
BE VERY CAREFUL with the bylevel option, as it happily averages over whatever data exists, and can produce results that are not easily interpretable (for example means can be biased by including or not including comparable levels). In this particular setting, the control treatment is excluded from the factorial means, but included in the list of means so mean separation can be conducted as usual, providing a perfect solution to our problem.
However, suppose the control treatment does share a level of the factorial. We can create this situation by taking the data above and redefining the control, then rerunning the analysis.
data fake2; set fake;
if treatment='Control' then timing='early';
run;
proc mixed data=fake2;
class block treatment timing;
model y = treatment | timing;
random block;
lsmeans treatment | timing /bylevel;
run;
Finally, for those who use the %danda macro, the SAS code is
%include 'danda.sas';
%mmaov(fake,y,class=block treatment timing, fixed=treatment|timing, random=block, options=bylevel);
Fert1:Irrig2 Fert2:Irrig1 Fert1:Irrig1
Fert2:Irrig3 Fert1:Irrig3 Fert2:Irrig2 Control
Other situations might have the control sharing a level of one of the factors, for example the control might be defined as Fert2:Irrig4. But this still causes problems with estimation of least squares means due to the levels of one factor not occurring with all levels of the other factor.
Let's jump into a SAS example, but using random numbers to allow easy creation of the example data. This code creates 13 treatments, a 4 by 3 factorial plus a control, each tested in 3 blocks of a randomized block design.
data fake;
do block=1,2,3;
treatment='Control'; timing='control'; y=100 + 20*block + 10*rannor(46390); output;
do treatment='A','B','C','D';
do timing='early','mid','late';
y=100 + 20*block + 10*rannor(46390);
output;
end;end;end;
run;
If we run a standard mixed model ANOVA, you will see that all of the main effect means are missing. The control treatment creates a level that all of the other levels are missing, thus the means are undefined.
proc mixed data=fake;
class block treatment timing;
model y = treatment | timing;
random block;
lsmeans treatment | timing ;
run;
An academic solution is to change the model to
model y = treatment * timing;
which has the effect of analyzing just the 13 treatments, and then using contrast and estimate statements to extract the desired information. But imagine the difficulty, as there will be 3 contrasts to recreate the main effect and interaction tests of the ANOVA table, 7 estimates to get the main effect means, then 10+6 contrasts to compare the main effect means to each other if mean separation information is needed.
A simpler solution is to use the bylevel option, which requests that least squares means only average over the levels that exist. The code is
proc mixed data=fake;
class block treatment timing;
model y = treatment | timing;
random block;
lsmeans treatment | timing / bylevel ;
run;
and you now see all means being estimated, and the ANOVA has the expected factorial DF. We can verify that the means are averaged over the expected treatments by requesting raw means, and find them identical.
proc means data=fake; ways 1 2;
class treatment timing;
var y;
run;
BE VERY CAREFUL with the bylevel option, as it happily averages over whatever data exists, and can produce results that are not easily interpretable (for example means can be biased by including or not including comparable levels). In this particular setting, the control treatment is excluded from the factorial means, but included in the list of means so mean separation can be conducted as usual, providing a perfect solution to our problem.
However, suppose the control treatment does share a level of the factorial. We can create this situation by taking the data above and redefining the control, then rerunning the analysis.
data fake2; set fake;
if treatment='Control' then timing='early';
run;
proc mixed data=fake2;
class block treatment timing;
model y = treatment | timing;
random block;
lsmeans treatment | timing /bylevel;
run;
Now you will see that the DF for treatment in the ANOVA table is incorrect (includes control differences), and the least squares mean for early timing is incorrect, biased by inclusion of the control.
Therefore this bylevel solution only works if the control is defined as distinct from the factorial, not sharing any of the factorial levels.Finally, for those who use the %danda macro, the SAS code is
%include 'danda.sas';
%mmaov(fake,y,class=block treatment timing, fixed=treatment|timing, random=block, options=bylevel);
Comments
Post a Comment