LMIXED Procedure
CONTRAST Statement
CONTRAST 'label' contrast-specification <, contrast-specification> <, …> </ 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 the random effects as fixed. The GLM procedure uses the narrow inference space. Finally, by zeroing portions of
that correspond 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.
You can specify the following:
- label
identifies the contrast in the table. A label is required for every contrast that you specify. Labels can be up to 20 characters long and must be enclosed in single quotes.
- contrast-specification
-
identifies the fixed and random effects and their coefficients from which the
matrix is formed. Each contrast-specification is referred to as a row in the
matrix. Specifically, contrast-specification takes the form
< fixed-effect values …> < | random-effect values …>
- fixed-effect
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 appear in the MODEL statement.
- random-effect
identifies an effect that appears in the RANDOM statement. The first random effect must follow a vertical bar (|); however, random effects are not required.
- values
are constants that are elements of the
matrix associated with the fixed and random effects.
The contrast-specification is specified by a series of nonpositional units. Each unit starts with an effect name, followed by a list of elements in square brackets. In each set of square brackets, you enter the coefficient and level indicators for each variable in an effect. A nonpositional unit has the following form:
effect-name [coefficient, level indicators]
[coefficient, level indicators]
...
[coefficient, level indicators]
For example, in the following CONTRAST statement, the contrast-specification has two nonpositional units. The first unit is "b [1, 1] [-1, 2]", and the second unit is "a*b [1, 2 1] [-1, 2 2]".
class a b;
model y = a b a*b;
contrast 'B at A2'
b [1, 1] [-1, 2]
a*b [1, 2 1] [-1, 2 2];
The first nonpositional unit starts with effect 'b', followed by two sets of square brackets. In bracket [1,1], the first element is the coefficient, and the second element is the level indicator 1, which corresponds to the first level of the CLASS variable 'b'.
The second nonpositional unit starts with effect 'a*b', followed by two sets of square brackets, [1, 2 1] and [-1, 2 2]. In bracket [1,2 1], the coefficient is 1, and the level indicators are the second level of variable 'a' and the first level of variable 'b'. In bracket [-1,2 2], the coefficient is -1, and the level indicators are the second level of variable 'a' and the second level of variable 'b'.
The comma that separates the coefficient and level indicators in a bracket is optional.
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 LMIXED finds the fixed-effects portion in at least one specified contrast-specification to be nonestimable (see the SINGULAR= option), then it determines that the whole contrast is nonestimable and displays missing values for the test statistics and a note in the log.
Assume that there are two fixed effects, 'a' and 'a*b'. If you specify the coefficient for effect 'a' but not for effect 'a*b', then the coefficients for effect 'a' are automatically "filled in" over the levels of the higher-order effect 'a*b'. This feature is designed to preserve estimability in cases where there are complex higher-order effects. The coefficients for the higher-order effect are determined by equitably distributing the coefficients of the lower-level effect. 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 for coefficients and does not contain any coefficient-specified effects, then all of its coefficients in are set to 0. You can override this default by specifying coefficients for the higher-order effect.
If you specify a SUBJECT effect in the RANDOM statement, then the coefficients that you specify 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 LMIXED handles missing level combinations of CLASS variables similarly to the way PROC GLM does. Both procedures delete fixed-effects parameters that correspond to missing levels in order to preserve estimability. However, PROC LMIXED does not delete missing level combinations for random-effects parameters because linear combinations of the random-effects parameters are always estimable. These conventions can affect the way that you specify the CONTRAST statement 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 degrees of freedom in the F approximation is
, and the denominator degrees of freedom is the residual degrees of freedom that you define by specifying the DDFM=RESIDUAL option. You can change the denominator degrees of freedom by using the DF= option.
Results from all CONTRAST statements are displayed together in the Contrasts ODS table.
You can specify the following options in the CONTRAST statement after a slash (/):