1. Home
  2. RTCOMPARISONS procedure

RTCOMPARISONS procedure

Calculates comparison contrasts within a multi-way table of means (R.W. Payne).

Options

PRINT = string token Controls printed output (contrasts); default cont
COMBINATIONS = string token Factor combinations for which to form the predicted means (full, present, estimable); default esti
ADJUSTMENT = string token Type of adjustment to be made when forming the predicted means (marginal, equal, observed); default marg
WEIGHTS = table Weights classified by some or all of the factors in the model; default *
OFFSET = scalar Value of offset on which to base predictions; default mean of offset variate
METHOD = string token Method of forming margin (mean, total); default mean
ALIASING = string token How to deal with aliased parameters (fault, ignore); default faul
BACKTRANSFORM = string token What back-transformation to apply to the values on the linear scale, before calculating the predicted means (link, none); default link
SCOPE = string token Controls whether the variance of predictions is calculated on the basis of forecasting new observations rather than summarizing the data to which the model has been fitted (data, new); default data
NOMESSAGE = string tokens Which warning messages to suppress (dispersion, nonlinear); default *
DISPERSION = scalar Value of dispersion parameter in calculation of s.e.s; default is as set in the MODEL statement
DMETHOD = string token Basis of estimate of dispersion, if not fixed by DISPERSION option (deviance, Pearson); default is as set in the MODEL statement
NBINOMIAL = scalar Supplies the total number of trials to be used for prediction with a binomial distribution (providing a value n greater than one allows predictions to be made of the number of “successes” out of n, whereas the value one predicts the proportion of successes); default 1
SAVE = identifier Regression or ANOVA save structure for the analysis from which the comparisons are to be calculated

Parameters

CONTRAST = tables Defines the comparisons to be estimated
ESTIMATES = scalars Saves the estimated contrasts
SE = scalars Saves standard errors of the contrasts

Description

RTCOMPARISONS makes comparisons within multi-way tables of predicted means from a linear or generalized linear regression or an analysis of variance. The model should previously have been fitted by the FIT or ANOVA directives in the usual way. The SAVE option can be used to specify the save structure from the analysis for which the comparisons are to be calculated (see the SAVE option of the MODEL or ANOVA directives). If SAVE is not specified, the comparisons are calculated from the most recent regression analysis.

Each comparison is specified in a table supplied by the CONTRAST parameter. For a regression or generalized linear models analysis, RTCOMPARISONS 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 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. Alternatively, you can supply your own table of weights, using the WEIGHTS option. The COMBINATIONS and ADJUSTMENT options are irrelevant if a SAVE structure is from an ANOVA analysis – the means are then obtained using AKEEP (and correspond to those that would be printed by ANOVA). The options OFFSET, METHOD, ALIASING, BACKTRANSFORM, SCOPE, NOMESSAGE, DISPERSION, DMETHOD and NBINOMIAL are also relevant only to regression, and operate exactly as in the PREDICT directive.

The PRINT option controls printed output, with setting:

    contrasts to print the contrasts (default).

The ESTIMATE parameter allows you to save the estimated contrast, and the SE parameter can save its standard error.

Options: PRINT, COMBINATIONS, ADJUSTMENT, WEIGHTS, OFFSET, METHOD, ALIASING, BACKTRANSFORM, SCOPE, NOMESSAGE, DISPERSION, DMETHOD, NBINOMIAL, SAVE.

Parameters: CONTRAST, ESTIMATE, SE.

Method

The predicted means and their variances and covariances are obtained using the PREDICT directive for a regression analysis, or using AKEEP for an analysis of variance. The comparisons and their standard errors are then calculated using Genstat’s table and matrix calculation facilities.

See also

Directive: PREDICT.

Procedures: FCONTRASTS, RCOMPARISONS, VTCOMPARISONS.

Commands for: Regression analysis.

Example

CAPTION       'RTCOMPARISONS example',\
              !t('3x2 factorial experiment (Snedecor & Cochran, 1980,',\
              'Statistical Methods, seventh edition, p. 305).');\
              STYLE=meta,plain
FACTOR        [NVALUES=60; LABELS=!T(high,low); VALUES=3(1,2)10] Amount
&             [LABELS=!T(beef,cereal,pork); VALUES=(1...3)20] Source
VARIATE       [NVALUE=60] Gain
READ          Gain
 73  98  94  90 107  49
102  74  79  76  95  82
118  56  96  90  97  73
104 111  98  64  80  86
 81  95 102  86  98  81
107  88 102  51  74  97
100  82 108  72  74 106
 87  77  91  90  67  70
117  86 120  95  89  61
111  92 105  78  58  82 :
MODEL         Gain
FIT           Source*Amount
CAPTION       !t('Comp1 compares high beef with low cereal, and Comp2',\
              'compares the mean of high beef & high pork with low cereal.')
TABLE         [CLASSIFICATION=Amount,Source] Comp1,Comp2;\
              VALUES=!(1,0,0,0,-1,0),!(0.5,0,0.5,0,-1,0)
PRINT         Comp1
&             Comp2
RTCOMPARISONS Comp1,Comp2
Updated on June 18, 2019

Was this article helpful?