CONTRAST Subcommand (LOGLINEAR command)

CONTRAST indicates the type of contrast desired for a factor, where a factor is any categorical dependent or independent variable. The default contrast is DEVIATION for each factor.

  • The specification is CONTRAST, which is followed by a variable name in parentheses and the contrast-type keyword.
  • To specify a contrast for more than one factor, use a separate CONTRAST subcommand for each specified factor. Only one contrast can be in effect for each factor on each DESIGN.
  • A contrast specification remains in effect for subsequent designs until explicitly overridden by another CONTRAST subcommand.
  • The design matrix used for the contrasts can be displayed by specifying the keyword DESIGN on the PRINT subcommand. However, this matrix is the basis matrix that is used to determine contrasts; it is not the contrast matrix itself.
  • CONTRAST can be used for a multinomial logit model, in which the dependent variable has more than two categories.
  • CONTRAST can be used for fitting linear logit models. The keyword BASIS is not appropriate for such models.
  • In a logit model, CONTRAST is used to transform the independent variable into a metric variable. Again, the keyword BASIS is not appropriate.

The following contrast types are available:

DEVIATION(refcat). Deviations from the overall effect. DEVIATION is the default contrast if the CONTRAST subcommand is not used. Refcat is the category for which parameter estimates are not displayed (they are the negative of the sum of the others). By default, refcat is the last category of the variable.

DIFFERENCE. Levels of a factor with the average effect of previous levels of a factor. Also known as reverse Helmert contrasts.

HELMERT. Levels of a factor with the average effect of subsequent levels of a factor.

SIMPLE(refcat). Each level of a factor to the reference level. By default, LOGLINEAR uses the last category of the factor variable as the reference category. Optionally, any level can be specified as the reference category enclosed in parentheses after the keyword SIMPLE. The sequence of the level, not the actual value, must be specified.

REPEATED. Adjacent comparisons across levels of a factor.

POLYNOMIAL(metric). Orthogonal polynomial contrasts. The default is equal spacing. Optionally, the coefficients of the linear polynomial can be specified in parentheses, indicating the spacing between levels of the treatment measured by the given factor.

[BASIS]SPECIAL(matrix). User-defined contrast. As many elements as the number of categories squared must be specified. If BASIS is specified before SPECIAL, a basis matrix is generated for the special contrast, which makes the coefficients of the contrast equal to the special matrix. Otherwise, the matrix specified is transposed and then used as the basis matrix to determine coefficients for the contrast matrix.

Example

LOGLINEAR  A(1,4) BY B(1,4)
 /CONTRAST(B)=POLYNOMIAL
 /DESIGN=A A BY B(1)
 /CONTRAST(B)=SIMPLE
 /DESIGN=A A BY B(1).
  • The first CONTRAST subcommand requests polynomial contrasts of B for the first design.
  • The second CONTRAST subcommand requests the simple contrast of B, with the last category (value 4) used as the reference category for the second DESIGN subcommand.

Example

* Multinomial logit model
 
LOGLINEAR  PREF(1,5) BY RACE ORIGIN CAMP(1,2)
  /CONTRAST(PREF)=SPECIAL(5*1, 1 1 1 1 -4, 3 -1 -1 -1 0,
        0 1 1 -2 0, 0 1 -1 0 0).
  • LOGLINEAR builds special contrasts among the five categories of the dependent variable PREF, which measures preference for training camps among Army recruits. For PREF, 1=stay, 2=move to north, 3=move to south, 4=move to unnamed camp, and 5=undecided.
  • The four contrasts are: (1) move or stay versus undecided, (2) stay versus move, (3) named camp versus unnamed, and (4) northern camp versus southern. Because these contrasts are orthogonal, SPECIAL and BASIS SPECIAL produce equivalent results.

Example

* Contrasts for a linear logit model
 
LOGLINEAR RESPONSE(1,2) BY YEAR(0,20)
 /PRINT=DEFAULT ESTIM
 /CONTRAST(YEAR)=SPECIAL(21*1, -10, -9, -8, -7, -6, -5, -4,
                           -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7,
                            8, 9, 10, 399*1)
 /DESIGN=RESPONSE RESPONSE BY YEAR(1).
  • YEAR measures years of education and ranges from 0 through 20. Therefore, allowing for the constant effect, YEAR has 20 estimable parameters associated with it.
  • The SPECIAL contrast specifies the constant—that is, 21*1—and the linear effect of YEAR—that is, –10 to 10. The other 399 1’s fill out the 21*21 matrix.

Example

* Contrasts for a logistic regression model
 
LOGLINEAR RESPONSE(1,2) BY TIME(1,4)
  /CONTRAST(TIME) = SPECIAL(4*1, 7 14 27 51, 8*1)
  /PRINT=ALL /PLOT=DEFAULT
  /DESIGN=RESPONSE, TIME(1) BY RESPONSE.
  • CONTRAST is used to transform the independent variable into a metric variable.
  • TIME represents elapsed time in days. Therefore, the weights in the contrast represent the metric of the passage of time.