CUSTOM Subcommand (CSCOXREG command)

The CUSTOM subcommand defines custom hypothesis tests by specifying the L matrix (contrast coefficients matrix) and the K matrix (contrast results matrix) in the general form of the linear hypothesis LB = K. The vector B is the parameter vector in the linear model.

  • Multiple CUSTOM subcommands are allowed. Each subcommand is treated independently.
  • An optional label may be specified by using the LABEL keyword. The label is a string with a maximum length of 255 characters. Only one label can be specified.
  • Either the LMATRIX or KMATRIX keyword, or both, must be specified.

    LMATRIX. Contrast coefficients matrix. This matrix specifies coefficients of contrasts, which can be used for studying the effects in the model. An L matrix can be specified by using the LMATRIX keyword.

    KMATRIX. Contrast results matrix. This matrix specifies the results of the linear hypothesis. A K matrix can be specified by using the KMATRIX keyword.

  • The number of rows in the L and K matrices must be equal.
  • A custom hypothesis test can be formed by specifying an L or K matrix, or both. If only one matrix is specified, the unspecified matrix uses the defaults described below.
  • If KMATRIX is specified but LMATRIX is not specified, the L matrix is assumed to be the row vector corresponding to the intercept in the estimable function, provided that INCLUDE = YES or ONLY is specified on the INTERCEPT subcommand. In this case, the K matrix can be only a scalar matrix.
  • The default K matrix is a zero matrix—that is, LB = 0 is assumed.
  • There are three general formats that can be used on the LMATRIX keyword: (1) Specify a coefficient value for the intercept, followed optionally by an effect name and a list of real numbers. (2) Specify an effect name and a list of real numbers. (3) Specify keyword ALL and a list of real numbers. In all three formats, there can be multiple effect names (or instances of the keyword ALL) and number lists.
  • Only valid effects in the default model or on the MODEL subcommand can be specified on the LMATRIX keyword.
  • The length of the list of real numbers on the LMATRIX keyword must be equal to the number of parameters (including the redundant parameters) corresponding to the specified effect. For example, if the effect A*B takes up six columns in the design matrix, the list after A*B must contain exactly six numbers.
  • When ALL is specified, the length of the list that follows ALL must be equal to the total number of parameters (including the redundant parameters) in the model.
  • Effects that are in the model but not specified on the LMATRIX keyword are assumed to have entries of 0 in the corresponding columns of the L matrix.
  • When an L matrix is being defined, a number can be specified as a fraction with a positive denominator. For example, 1/3 and –1/3 are valid, but 1/–3 is invalid.
  • A semicolon (;) indicates the end of a row in the L matrix.
  • The format for the KMATRIX keyword is one or more real numbers. If more than one number is specified, then separate adjacent numbers using a semicolon (;). Each semicolon indicates the end of a row in the K matrix. Each number is the hypothesized value for a contrast, which is defined by a row in the L matrix.
  • For the KMATRIX keyword to be valid, either the LMATRIX keyword, or INCLUDE = YES on the INTERCEPT subcommand, must be specified.

Example

Suppose that factors A and B each have three levels.

CSCOXREG t BY a b
  /VARIABLES STATUS=death(1)
  /PLAN FILE=’c:\survey\myfile.csplan’
  /MODEL a b a*b
  /CUSTOM  LABEL = “Effect A”
     LMATRIX = 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.
  • The preceding syntax specifies a test of effect A.
  • Because there are three levels in effect A, two independent contrasts can be formed at most; thus, there are two rows in the L matrix separated by a semicolon (;).
  • There are three levels each in effects A and B; thus, the interaction effect A*B takes nine columns in the design matrix.
  • The first row in the L matrix tests the difference between levels 1 and 3 of effect A; the second row tests the difference between levels 2 and 3 of effect A.
  • The KMATRIX keyword is not specified, so the null hypothesis value for both tests is 0.

Example

Suppose that factor A has three levels.

CSCOXREG t BY a
  /VARIABLES STATUS=death(1)
  /PLAN FILE=’c:\survey\myfile.csplan’
  /MODEL a
  /CUSTOM  LABEL = ‘Effect A’
   LMATRIX = a 1 0 -1;
             a 0 1 -1
   KMATRIX = 1; 1.
  • The syntax specifies a model with a main effect for factor A and a custom hypothesis test of effect A.
  • The equivalent LMATRIX keyword using the ALL option follows.
    LMATRIX = ALL 1  0 -1;
              ALL 0  1 -1
  • The KMATRIX keyword is specified and the hypothesis that the difference between levels 1 and 3 and levels 2 and 3 of effect A are both equal to 1 is tested.