LMATRIX Subcommand (GLM: Univariate command)

The LMATRIX subcommand allows you to customize your hypotheses tests by specifying the L matrix (contrast coefficients matrix) in the general form of the linear hypothesis LB = K, where K = 0 if it is not specified on the KMATRIX subcommand. The vector B is the parameter vector in the linear model.

  • The basic format for the LMATRIX subcommand is an optional label in quotation marks, one or more effect names or the keyword ALL, and one or more lists of real numbers.
  • The optional label is a string with a maximum length of 255 bytes. Only one label can be specified.
  • Only valid effects that appear or are implied on the DESIGN subcommand can be specified on the LMATRIX subcommand.
  • The length of the list of real numbers must be equal to the number of parameters (including the redundant parameters) corresponding to that effect. For example, if the effect A*B uses six columns in the design matrix, the list after A*B must contain exactly six numbers.
  • A number can be specified as a fraction with a positive denominator (for example, 1/3 or –1/3 are valid, but 1/–3 is invalid).
  • A semicolon (;) indicates the end of a row in the L matrix.
  • When ALL is specified, the length of the list that follows ALL is equal to the total number of parameters (including the redundant parameters) in the model.
  • Effects that appear or are implied on the DESIGN subcommand must be explicitly specified here.
  • If LMATRIX is specified along with the ROBUST subcommand, then contrast estimates and tests are calculated with the robust covariance matrix, in addition to the tests that use the standard (or model-based) covariance matrix.
  • Multiple LMATRIX subcommands are allowed. Each subcommand is treated independently.

Example

GLM DEP BY A B
  /LMATRIX = "B1 vs B2 at A1"
              B 1 -1 0 A*B 1 -1 0 0 0 0 0 0 0
  /LMATRIX = "Effect A"
              A 1 0 -1 
              A*B 1/3  1/3  1/3
                   0    0    0
                 -1/3 -1/3 -1/3;
              A 0 1 -1
              A*B  0    0    0
                  1/3  1/3  1/3
                 -1/3 -1/3 -1/3
  /LMATRIX = "B1 vs B2 at A2"
             ALL  0
                  0  0  0
                  1 -1  0
                  0  0  0  1 -1  0 0  0  0
  /DESIGN = A, B, A*B.

Assume that factors A and B each have three levels. There are three LMATRIX subcommands; each subcommand is treated independently.

  • B1 Versus B2 at A1. In the first LMATRIX subcommand, the difference is tested between levels 1 and 2 of effect B when effect A is fixed at level 1. Because there are three levels each in effects A and B, the interaction effect A*B should use nine columns in the design matrix.
  • Effect A. In the second LMATRIX subcommand, effect A is tested. Because there are three levels in effect A, no more than two independent contrasts can be formed; thus, there are two rows in the L matrix, which are separated by a semicolon (;). The first row tests the difference between levels 1 and 3 of effect A, while the second row tests the difference between levels 2 and 3 of effect A.
  • B1 Versus B2 at A2. In the last LMATRIX subcommand, the keyword ALL is used. The first 0 corresponds to the intercept effect; the next three instances of 0 correspond to effect A.