CUSTOM Subcommand (CSGLM 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
orKMATRIX
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 butLMATRIX
is not specified, the L matrix is assumed to be the row vector corresponding to the intercept in the estimable function, provided thatINCLUDE = YES
orONLY
is specified on theINTERCEPT
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 keywordALL
and a list of real numbers. In all three formats, there can be multiple effect names (or instances of the keywordALL
) and number lists. - Only valid effects in the default model or on the
MODEL
subcommand can be specified on theLMATRIX
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 followsALL
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 theLMATRIX
keyword, orINCLUDE = YES
on theINTERCEPT
subcommand, must be specified.
Example
Suppose that factors A and B each have three levels.
CSGLM y BY a b
/PLAN FILE='/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 factors A and B each have three levels.
CSGLM y BY a b
/PLAN FILE='/survey/myfile.csplan'
/CUSTOM LABEL = “Effect A”
LMATRIX = a 1 0 -1; a 1 –1 0
/CUSTOM LABEL = “Effect B”
LMATRIX = b 1 0 –1; b 1 –1 0
KMATRIX = 0; 0.
- The preceding syntax specifies tests of effects A and B.
- The
MODEL
subcommand is not specified, so the default model—which includes the intercept and main effects for A and B—is used. - There are two
CUSTOM
subcommands; each subcommand specifies two rows in the L matrix. - The first
CUSTOM
subcommand does not specify theKMATRIX
keyword. By default, this subcommand tests whether the effect of factor A is 0. - The second
CUSTOM
subcommand specifies theKMATRIX
keyword. This subcommand tests whether the effect of factor B is 0.