RCOMPARISONS procedure
Calculates comparison contrasts amongst regression means (R.W. Payne).
Options
Parameters
Description
RCOMPARISONS allows you to make comparisons between predicted means from a linear or generalized linear regression. The model should previously have been fitted by the FIT directive in the usual way. The SAVE option can be used to specify the regression save structure from the analysis for which the comparisons are to be calculated (see the SAVE option of the MODEL directive). If SAVE is not specified, the comparisons are calculated from the most recent regression analysis.
The factor amongst whose levels the comparisons are to be calculated is specified by the FACTOR parameter. The CONTRASTS parameter supplies a matrix to specify the comparisons to be calculated. This works in the same way as the matrix supplied as the third parameter of the COMPARISONS function, with a column for each level of the FACTOR, and a row for each comparison. You can set the ORDER parameter to a scalar, n say, to indicate that only the comparisons in the first n rows of the CONTRASTS matrix are to be calculated (otherwise they are all calculated).
By default the comparisons are calculated between the means in the one-way table classified by FACTOR. However, you can set the GROUPS parameter to some other factor to indicate that the comparisons are to be made for each level of that factor, or you can set it to a pointer of factors to make the comparisons for every combination of the levels of those factors.
RCOMPARISONS calculates the means using the PREDICT directive. The first step (A) of the calculation forms the full table of predictions, classified by every factor in the model. The second step (B) averages the full table of over the factors that do not occur in the table of means. The COMBINATIONS option specifies which cells of the full table are to be formed in Step A. The default setting, estimable, fills in all the cells other than those that involve parameters that cannot be estimated, for example because of aliasing. Alternatively, setting COMBINATIONS=present excludes the cells for factor combinations that do not occur in the data, or COMBINATIONS=full uses all the cells. The ADJUSTMENT option then defines how the averaging is done in Step B. The default setting, marginal, forms a table of marginal weights for each factor, containing the proportion of observations with each of its levels; the full table of weights is then formed from the product of the marginal tables. The setting equal weights all the combinations equally. Finally, the setting observed uses the WEIGHTS option of PREDICT to weight each factor combination according to its own individual replication in the data.
The PRINT option controls printed output, with settings:
By default these are both printed. The PSE option controls the types of standard errors that are produced to accompany the contrasts, with settings:
The default is contrasts. The LSDLEVEL option sets the significance level (as a percentage) for the least significant differences.
The ESTIMATES parameter allows you to save the estimated contrasts. These are in a variate if GROUPS is unset, or in a pointer containing a table classified by GROUPS for each comparison otherwise. The SE parameter saves the standard errors of the contrasts, in a variate or pointer similarly to ESTIMATES. If GROUPS is set, you can also save standard errors for differences between the contrasts estimated for different levels of the GROUPS factor(s). This is again a pointer, with a symmetric matrix for each comparison. Finally, the DF parameter can save a variate containing the degrees of freedom of the contrasts, and the SS parameter can save a variate with their sums of squares.
Options: PRINT, COMBINATIONS, ADJUSTMENT, PSE, LSDLEVEL, SAVE.
Parameters: FACTOR, CONTRASTS, ORDER, GROUPS, ESTIMATES, SE, SED, LSD, DF, SS.
Method
The predicted means and their variances and covariances are calculated using the PREDICT directive. The comparisons, their standard errors and sums of squares are then calculated using GenStat's table and matrix calculation facilities.