RCOMPARISONS procedure

Calculates comparison contrasts amongst regression means (R.W. Payne).


Options

PRINT = string
Controls printed output (aov, contrasts); default aov, cont

COMBINATIONS = string
Factor combinations for which to form the predicted means (full, present, estimable); default esti

ADJUSTMENT = string
Type of adjustment to be made when forming the predicted means (marginal, equal, observed); default marg

PSE = strings
Types of standard errors to be printed with the contrasts (contrasts, differences, lsd); default cont

LSDLEVEL = scalar
Significance level (%) for least significant differences; default 5

SAVE = identifier
Regression save structure for the analysis from which the comparison contrasts are to be calculated


Parameters

FACTOR = factors
Factor whose levels are compared

CONTRASTS = matrices
Defines the comparisons to be estimated

ORDER = scalars
Number of comparisons to estimate; default is the number of rows of the CONTRASTS matrix

GROUPS = factors or pointers
Set if comparisons are to be made at different combinations of another factor or factors

ESTIMATES = variates or pointers
Saves the estimated contrasts in a variate if GROUPS is unset, or in a pointer to a set of tables

SE = variates or pointers
Saves standard errors of the contrasts in a variate if GROUPS is unset, or in a pointer to a set of tables

SED = pointers
Pointer to a set of symmetric matrices to save standard errors for differences between the contrasts estimated for different levels of the GROUPS factor(s)

LSD = pointers
Pointer to a set of symmetric matrices to save least significant differences for the contrasts estimated for different levels of the GROUPS factor(s)

DF = variates
Saves degrees of freedom for the contrasts

SS = variates
Saves sums of squares of the contrasts


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:

    aov
to print an analysis of variance giving the sums of squares and so on for the comparisons;

    contrasts
to print the contrasts.

By default these are both printed. The PSE option controls the types of standard errors that are produced to accompany the contrasts, with settings:

    contrasts
for standard errors of the contrasts;

    differences
for standard errors for differences between pairs of contrasts calculated for the different GROUPS;

    lsd
for least significant differences for contrasts calculated for the GROUPS.

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.