Chapter Contents |
Previous |
Next |

The ANOVA Procedure |

The analysis-of-variance model specifies *effects*, which
are combinations of classification variables used to explain the
variability of the dependent variables in the following manner:

- Main effects are specified by writing the variables by themselves in the CLASS statement: A B C. Main effects used as independent variables test the hypothesis that the mean of the dependent variable is the same for each level of the factor in question, ignoring the other independent variables in the model.
- Crossed effects (interactions) are specified by joining the class variables with asterisks in the MODEL statement: A*B A*C A*B*C. Interaction terms in a model test the hypothesis that the effect of a factor does not depend on the levels of the other factors in the interaction.
- Nested effects are specified by following a main effect or crossed effect with a class variable or list of class variables enclosed in parentheses in the MODEL statement. The main effect or crossed effect is nested within the effects listed in parentheses: B(A) C*D(A B). Nested effects test hypotheses similar to interactions, but the levels of the nested variables are not the same for every combination within which they are nested.

The general form of an effect can be illustrated using the class variables A, B, C, D, E, and F:

- A* B* C( D E F)

The crossed list should come first, followed by the nested list in parentheses. Note that no asterisks appear within the nested list or immediately before the left parenthesis.

proc anova; class A B C; model Y=A B C; run;

proc anova; class A B C; model Y=A B C A*B A*C B*C A*B*C; run;

proc anova; class A B C; model Y=A|B|C; run;

When the bar (|) is used, the expression on the right side of the equal sign is expanded from left to right using the equivalents of rules 2 -4 given in Searle (1971, p. 390). The variables on the right- and left-hand sides of the bar become effects, and the cross of them becomes an effect. Multiple bars are permitted. For instance, A | B | C is evaluated as follows:

A | B | C | { A | B } | C | |

{ A B A*B } | C | ||

A B A*B A*C B*C A*B*C |

You can also specify the maximum number of variables involved in any effect that results from bar evaluation by specifying that maximum number, preceded by an @ sign, at the end of the bar effect. For example, the specification A | B | C@2 results in only those effects that contain two or fewer variables; in this case, A B A*B C A*C and B*C.

The following table gives more examples of using the bar and at operators.

A | C(B) | is equivalent to | A C(B) A*C(B) |

A(B) | C(B) | is equivalent to | A(B) C(B) A*C(B) |

A(B) | B(D E) | is equivalent to | A(B) B(D E) |

A | B(A) | C | is equivalent to | A B(A) C A*C B*C(A) |

A | B(A) | C@2 | is equivalent to | A B(A) C A*C |

A | B | C | D@2 | is equivalent to | A B A*B C A*C B*C D A*D B*D C*D |

proc anova; class A B C; model y=A B C(A B); run;

The identity of a level is viewed within the context of the level of the containing effects. For example, if City is nested within State, then the identity of City is viewed within the context of State.

The distinguishing feature of a nested specification is that nested effects never appear as main effects. Another way of viewing nested effects is that they are effects that pool the main effect with the interaction of the nesting variable. See the "Automatic Pooling" section, which follows.

proc anova; class A B C; model Y=A B(A) C(A) B*C(A); run;

model Y=A B(A);

and

model Y=A A*B;

The effect B becomes a nested effect by virtue of the fact that it does not occur as a main effect. If B is not written as a main effect in addition to participating in A*B, then the sum of squares that is associated with B is pooled into A*B.

This feature allows the automatic pooling of sums of squares. If an effect is omitted from the model, it is automatically pooled with all the higher-level effects containing the class variables in the omitted effect (or within-error). This feature is most useful in split-plot designs.

Chapter Contents |
Previous |
Next |
Top |

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.