CONTRAST Subcommand (GLM: Univariate command)
CONTRAST
specifies the type of contrast that is desired among the levels
of a factor. For a factor with k levels or values, the contrast type determines the meaning of its k−1 degrees of freedom.
- Specify the factor name in parentheses following
the subcommand
CONTRAST
. - You can specify only one factor per
CONTRAST
subcommand, but you can enter multipleCONTRAST
subcommands. - After closing the parentheses, enter an equals sign followed by one of the contrast keywords.
- This subcommand creates an L matrix where the columns corresponding to the factor match the contrast that is given. The other columns are adjusted so that the L matrix is estimable.
The following contrast types are available:
- DEVIATION
- Deviations from the grand mean. Each level of the factor except one
is compared to the grand mean. One category (by default, the first category) must be omitted so that
the effects will be independent of one another. To omit a category other than the first category,
specify the number of the omitted category (which is not necessarily the same as its value) in
parentheses after the keyword
DEVIATION
. An example is as follows:GLM Y BY B /CONTRAST(B)=DEVIATION(1).
- POLYNOMIAL
- Polynomial contrasts. This setting is the default for within-subjects
factors. The first degree of freedom contains the linear effect across the levels of the factor, the
second degree of freedom contains the quadratic effect, and so on. In a balanced design, polynomial
contrasts are orthogonal. By default, the levels are assumed to be equally spaced; you can specify
unequal spacing by entering a metric consisting of one integer for each level of the factor in
parentheses after the keyword
POLYNOMIAL
. (All metrics that are specified cannot be equal; thus, (1, 1, . . . 1) is not valid.) An example is as follows:GLM RESPONSE BY STIMULUS /CONTRAST(STIMULUS) = POLYNOMIAL(1,2,4)
- DIFFERENCE
- Difference or reverse Helmert contrasts. Each level of the factor (except the first level) is compared to the mean of the previous levels. In a balanced design, difference contrasts are orthogonal.
- HELMERT
- Helmert contrasts. Each level of the factor (except the last level) is compared to the mean of subsequent levels. In a balanced design, Helmert contrasts are orthogonal.
- SIMPLE
- Contrast where each level of the factor (except the first level) is
compared to the first level. To use a category other than the first category as the omitted
reference category, specify the category's number (which is not necessarily the same as its value)
in parentheses following the keyword
SIMPLE
. An example is as follows:GLM Y BY B /CONTRAST(B)=SIMPLE(1).
- REPEATED
- Comparison of adjacent levels. Each level of the factor (except the last level) is compared to the next level. Repeated contrasts are not orthogonal.
- SPECIAL
- A user-defined contrast. Values that are specified after this keyword
are stored in a matrix in column major order. For example, if factor A has three levels, then
CONTRAST(A)=
SPECIAL(1 1 1 1 -1 0 0 1 -1)
produces the following contrast matrix:1 1 0 1 –1 1 1 0 –1
Orthogonal contrasts are particularly useful. In a balanced design, contrasts are orthogonal
if the sum of the coefficients in each contrast row is 0 and if, for
any pair of contrast rows, the products of corresponding coefficients
sum to 0. DIFFERENCE
, HELMERT
, and POLYNOMIAL
contrasts always meet these criteria in balanced designs.
Example
GLM DEP BY FAC
/CONTRAST(FAC)=DIFFERENCE
/DESIGN.
- Suppose that the factor FAC has five categories and, therefore, has four degrees of freedom.
-
CONTRAST
requestsDIFFERENCE
contrasts, which compare each level (except the first level) with the mean of the previous levels.