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 multiple CONTRAST 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. This setting is the default for between-subjects factors. Each level of the factor except one is compared to the grand mean. One category (by default, the last category) must be omitted so that the effects will be independent of one another. To omit a category other than the last 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).

Suppose factor B has three levels, with values 2, 4, and 6. The specified contrast omits the first category, in which B has the value 2. Deviation contrasts are not orthogonal.

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)

Suppose that factor STIMULUS has three levels. The specified contrast indicates that the three levels of STIMULUS are actually in the proportion 1:2:4. The default metric is always (1, 2, . . . k), where k levels are involved. Only the relative differences between the terms of the metric matter. (1, 2, 4) is the same metric as (2, 3, 5) or (20, 30, 50) because, in each instance, the difference between the second and third numbers is twice the difference between the first and second.

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 last level) is compared to the last level. To use a category other than the last 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).

Suppose that factor B has three levels with values 2, 4, and 6. The specified contrast compares the other levels to the first level of B, in which B has the value 2. Simple contrasts are not orthogonal.

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

Note that unlike the LMATRIX subcommand, the CONTRAST subcommand does not accept fractions.

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 requests DIFFERENCE contrasts, which compare each level (except the first level) with the mean of the previous levels.