LMATRIX, MMATRIX, and KMATRIX Subcommands (GLM command)

  • The L matrix is called the contrast coefficients matrix. This matrix specifies coefficients of contrasts, which can be used for studying the between-subjects effects in the model. One way to define the L matrix is by specifying the CONTRAST subcommand, on which you select a type of contrast. Another way is to specify your own L matrix directly by using the LMATRIX subcommand. See the topic LMATRIX Subcommand (GLM: Univariate command) for more information.
  • The M matrix is called the transformation coefficients matrix. This matrix provides a transformation for the dependent variables. This transformation can be used to construct contrasts among the dependent variables in the model. The M matrix can be specified on the MMATRIX subcommand. See the topic MMATRIX Subcommand (GLM: Multivariate command) for more information.
  • The K matrix is called the contrast results matrix. This matrix specifies the results matrix in the general linear hypothesis. To define your own K matrix, use the KMATRIX subcommand. See the topic KMATRIX Subcommand (GLM: Univariate command) for more information.

For univariate and multivariate models, you can specify one, two, or all three of the L, M, and K matrices. If only one or two types are specified, the unspecified matrices use the defaults that are shown in the following table (read across the rows).

Table 1. Default matrices for univariate and multivariate models if one matrix is specified
L matrix M matrix K matrix
If LMATRIX is used to specify the L matrix Default = identity matrix* Default = zero matrix
Default = intercept matrix If MMATRIX is used to specify the M matrix Default = zero matrix
Default = intercept matrix Default = identity matrix* If KMATRIX is used to specify the K matrix

* The dimension of the identity matrix is the same as the number of dependent variables that are being studied.

The intercept matrix is the matrix that corresponds to the estimable function for the intercept term in the model, provided that the intercept term is included in the model. If the intercept term is not included in the model, the L matrix is not defined, and this custom hypothesis test cannot be performed.

Example

GLM Y1 Y2 BY A B
	/LMATRIX = A 1 -1
	/DESIGN A B.

Assume that factor A has two levels.

  • Because there are two dependent variables, this model is a multivariate model with two main factor effects, A and B.
  • A custom hypothesis test is requested by the LMATRIX subcommand.
  • Because no MMATRIX or KMATRIX is specified, the M matrix is the default two-dimensional identity matrix, and the K matrix is a zero-row vector (0, 0).

For a repeated measures model, you can specify one, two, or all three of the L, M, and K matrices. If only one or two types are specified, the unspecified matrices use the defaults that are shown in the following table (read across the rows).

Table 2. Default matrices for repeated measures models if only one matrix is specified
L matrix M matrix K matrix
If LMATRIX is used to specify the L matrix Default = average matrix* Default = zero matrix
Default = intercept matrix If MMATRIX is used to specify the M matrix Default = zero matrix
Default = intercept matrix Default = average matrix* If KMATRIX is used to specify the K matrix

* The average matrix is the transformation matrix that corresponds to the transformation for the between-subjects test. The dimension is the number of measures.

The intercept matrix is the matrix that corresponds to the estimable function for the intercept term in the model, provided that the intercept term is included in the model. If the intercept term is not included in the model, the L matrix is not defined, and this custom hypothesis test cannot be performed.

Example

GLM Y1 Y2 BY A B 
 /WSFACTOR TIME (2)
 /MMATRIX Y1 1 Y2 1; Y1 1 Y2 -1
 /DESIGN A B.
  • Because WSFACTOR is specified, this model is a repeated measures model with two between-subjects factors A and B, and a within-subjects factor, TIME.
  • A custom hypothesis is requested by the MMATRIX subcommand. The M matrix is a 2 x 2 matrix:
    1  1
    1 -1
  • Because the L matrix and K matrix are not specified, their defaults are used. The default for the L matrix is the matrix that corresponds to the estimable function for the intercept term in the between-subjects model, and the default for the K matrix is a zero-row vector (0, 0).