CONTRAST
’label’ contrastspecification <, contrastspecification> <, …> </ options> ;
The CONTRAST statement provides a mechanism for obtaining custom hypothesis tests. It is patterned after the CONTRAST statement in PROC MIXED and enables you to select an appropriate inference space (McLean, Sanders, and Stroup, 1991).
You can test the hypothesis , where and , in several inference spaces. The inference space corresponds to the choice of . When , your inferences apply to the entire population from which the random effects are sampled; this is known as the broad inference space. When all elements of are nonzero, your inferences apply only to the observed levels of the random effects. This is known as the narrow inference space, and you can also choose it by specifying all of the random effects as fixed. The GLM procedure uses the narrow inference space. Finally, by zeroing portions of corresponding to selected main effects and interactions, you can choose intermediate inference spaces. The broad inference space is usually the most appropriate, and it is used when you do not specify any random effects in the CONTRAST statement.
In the CONTRAST statement,
identifies the contrast in the table. A label is required for every contrast specified. Labels can be up to 20 characters and must be enclosed in single quotes.
identifies the fixed effects and random effects and their coefficients from which the matrix is formed. The syntax representation of a contrastspecification is <fixedeffect values …> < randomeffect values …>
identifies an effect that appears in the MODEL statement. The keyword INTERCEPT can be used as an effect when an intercept is fitted in the model. You do not need to include all effects that are in the MODEL statement.
identifies an effect that appears in the RANDOM statement. The first random effect must follow a vertical bar (); however, random effects do not have to be specified.
are constants that are elements of the matrix associated with the fixed and random effects.
The rows of are specified in order and are separated by commas. The rows of the component of are specified on the left side of the vertical bars (). These rows test the fixed effects and are, therefore, checked for estimability. The rows of the component of are specified on the right side of the vertical bars. They test the random effects, and no estimability checking is necessary.
If PROC HPMIXED finds the fixedeffects portion of the specified contrast to be nonestimable (see the SINGULAR= option), then it displays missing values for the test statistics and a note in the log.
If the elements of are not specified for an effect that contains a specified effect, then the elements of the specified effect are automatically “filled in” over the levels of the higherorder effect. This feature is designed to preserve estimability for cases where there are complex higherorder effects. The coefficients for the higherorder effect are determined by equitably distributing the coefficients of the lowerlevel effect as in the construction of least squares means. In addition, if the intercept is specified, it is distributed over all classification effects that are not contained by any other specified effect. If an effect is not specified and does not contain any specified effects, then all of its coefficients in are set to 0. You can override this behavior by specifying coefficients for the higherorder effect.
If too many values are specified for an effect, the extra ones are ignored; if too few are specified, the remaining ones are set to 0. If no random effects are specified, the vertical bar can be omitted; otherwise, it must be present. If a SUBJECT effect is used in the RANDOM statement, then the coefficients specified for the effects in the RANDOM statement are equitably distributed across the levels of the SUBJECT effect. You can use the E option to see exactly what matrix is used.
The SUBJECT and GROUP options in the CONTRAST statement are useful for the case where a SUBJECT= or GROUP= variable appears in the RANDOM statement, and you want to contrast different subjects or groups. By default, CONTRAST statement coefficients about random effects are distributed equally across subjects and groups.
PROC HPMIXED handles missing level combinations of CLASS variables similarly to the way PROC GLM does. Both procedures delete fixedeffects parameters corresponding to missing levels in order to preserve estimability. However, PROC HPMIXED does not delete missing level combinations for randomeffects parameters because linear combinations of the randomeffects parameters are always estimable. These conventions can affect the way you specify your CONTRAST coefficients.
The CONTRAST statement computes the statistic

where and approximates its distribution with an F distribution. In this expression, is an estimate of the generalized inverse of the coefficient matrix in the mixed model equations.
The numerator degree of freedom in the F approximation is , and the denominator degree of freedom is taken from the “Type III Tests of Fixed Effects” table and corresponds to the final effect you list in the CONTRAST statement. You can change the denominator degrees of freedom by using the DF= option.
You can specify the following options in the CONTRAST statement after a slash (/).