1. Home
  2. VTCOMPARISONS procedure


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


PRINT = string tokens Controls printed output (contrasts, Waldtests); default cont
MODEL = formula Indicates which model terms (fixed and/or random) are to be used in forming the predictions; default * includes all the fixed terms and relevant random terms
OMITTERMS = formula Specifies terms to be excluded from the MODEL; default * i.e. none
FACTORIAL = scalar Limit on the number of factors or variates in each term in the models specified by MODEL or OMITTERMS; default 3
PRESENTCOMBINATIONS = identifiers Lists factors for which averages should be taken across combinations that are present
WEIGHTS = tables One-way tables of weights classified by factors in the model; default *
GROUPS = factors Groups for which to estimate each contrast
DFMETHOD = string token Specifies which degrees of freedom to use for the comparisons (fddf, given, tryfddf, none); default fddf
DFGIVEN = scalar Specifies the number of degrees of freedom to use for the comparisons when DFMETHOD=given, or if d.d.f. are unavailable when DFMETHOD=tryfddf
FMETHOD = string token Controls how to calculate denominator degrees of freedom for the F-statistics, if these are not already available in the REML save structure (automatic, algebraic, numerical); default auto
SAVE = identifier REML save structure for the analysis from which the comparisons are to be calculated


CONTRAST = tables Defines the comparisons to be estimated
ESTIMATE = scalars or variates Saves the estimated contrasts
SE = scalars or variates Saves standard errors of the contrasts
VCOVARIANCE = symmetric matrices Save the variance-covariance matrices of contrasts estimated for GROUPS
STATISTIC = scalars or variates Saves saves the test statistic (t or Wald)
DF = scalars or variates Saves estimated numbers of residual degrees of freedom of the contrasts
PROBABILITY = scalars or variates Saves the probabilities of the contrasts
WALD = scalars Wald statistic for each comparison, combining the tests within groups
FSTATISTIC = scalars F statistics for each comparison, if available, combining the tests within groups
NDF = scalars Numerator d.f. for FSTATISTIC
DDF = scalars Denominator d.f. for FSTATISTIC


VTCOMPARISON makes comparisons within multi-way tables of predicted means from a REML analysis. The data should previously have been analysed by the REML directive 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 REML). If SAVE is not specified, the comparisons are calculated from the most recent REML analysis.

Each comparison is specified in a table supplied by the CONTRAST parameter. VTCOMPARISON calculates the means using the VPREDICT directive. The calculations consist of two steps. The first step is to calculate a table of fitted values. The MODEL, OMITTERMS and FACTORIAL options specify the model to use for this. The formula specified by MODEL is expanded into a list of model terms, deleting any that contain more variates or factors than the limit specified by the FACTORIAL option. Then, any terms in the formula specified by OMITTERMS are removed. The second step averages the fitted values over the classifications that are not in the list that was supplied by the CLASSIFY parameter. The WEIGHTS option can supply one-way tables classified by any of the factors in the model. These are used to calculate the weight to be used for each fitted value when calculating the averages. Equal weights are assumed for any factor for which no table of weights has been supplied. In the averaging all the fitted values are generally used. However, if you define a list of factors using the PRESENTCOMBINATIONS option, any combination of levels of these factors that does not occur in the data will be omitted from the averaging. Where a prediction is found to be inestimable, i.e. not invariant to the model parameterization, a missing value is given.

The GROUPS option is useful if you want to calculate the same comparisons for several groups, defined by the combinations of levels of one or more factors in the REML analysis. You can then use the CONTRAST parameter to define the comparison-definition tables ignoring the groups, and the GROUPS option to specify the factors defining the groups.

The DFMETHOD option specifies how to obtain the numbers of residual degrees of freedom for the comparisons. The default is to use the numbers of denominator degrees of freedom printed by REML in the d.d.f. column in the table of tests for fixed tests (produced by setting option PRINT=wald). These degrees of freedom are relevant for assessing the fixed term as a whole, and may differ over the various comparisons amongst its means, or for predictions produced with different models or weightings from those used in REML and VDISPLAY. So the t-probabilities should be used with caution. If you want a more exact probability for a comparison, you should set up a covariate to fit this explicitly in the analysis. The FMETHOD option controls how the denominator degrees of freedom should be calculated, if they are not already available in the REML save structure (e.g. because they were printed in the original analysis). The settings are the same as in the REML and VKEEP directives, except that there is no none setting. (You would set this option only if you really do want to calculate them.)

In some of the more complicated analyses, REML may be unable to calculate the denominator degrees of freedom. You might then want to supply the number of degrees of freedom yourself, using the DFGIVEN option, rather than having no probabilities at all. For example, you could use the number of denominator degrees of freedom from the analysis of an earlier similar design. However, the results will only be as good as the degrees of freedom that you have supplied, and thus should be used with caution! You can set option DFMETHOD=tryfddf to use the denominator degrees of freedom, if these can be calculated, or those specified by DFGIVEN otherwise. The setting DFMETHOD=given always uses the degrees of freedom specified by DFGIVEN.

If no d.d.f. are available, VTCOMPARISONS forms Wald statistics instead of t-statistics, and calculates their probabilities using the fact that, asymptotically, they have chi-square distributions with one degree of freedom. The Wald probabilities tend to be biased (giving too many significant results), and should thus be used with caution. You can set DFMETHOD=none to enforce the use of Wald statistics.

The PRINT option controls printed output, with settings:

    contrasts prints the contrasts (default); and
    Waldtests when GROUPS is set this prints Wald tests combining the tests of each contrast in the various groups, F tests are also given provided REML has been able to estimate the d.d.f.

The ESTIMATE parameter allows you to save the estimates for the comparisons. If the GROUPS option is not set, each comparison will have a single estimate which will be saved in a scalar. Alternatively, if there are groups, there will be an estimate for each group, and these will be saved in a variate defined with unit labels that identify the groups. Similarly, the SE parameter can save the standard errors of the comparisons, the DF parameter can save their estimated number of residual degrees for freedom, the STATISTIC parameter can save their test statistics (t or Wald), and the PROBABILITY parameter can save their probabilities.

When there are groups, the variances and covariances of the estimates for each contrast can be saved in a symmetric matrix, using the VCOVARIANCE parameter. The WALD, FSTATISTIC, NDF and DDF parameters can save the results of the tests combining the tests for each contrast in the various groups.



See also

Directive: VPREDICT.


Commands for: REML analysis of linear mixed models.


CAPTION  'VTCOMPARISON example',!t('Split plot design, see the',\
         'Guide to Genstat, Part 2, Section 4.2.1.'); STYLE=meta,plain
&        [LEVELS=3] Wplots
&        [LEVELS=4] Subplots
GENERATE Blocks,Wplots,Subplots
FACTOR   [LABELS=!T('0 cwt','0.2 cwt','0.4 cwt','0.6 cwt')] Nitrogen
&        [LABELS=!T(Victory,'Golden rain',Marvellous)]      Variety
VARIATE  Yield; DECIMALS=2; EXTRA=' of oats in cwt. per acre'
READ     [SERIAL=yes] Nitrogen,Variety,Yield
 4 3 2 1 1 2 4 3 1 2 3 4 3 1 2 4 4 1 2 3 2 1 3 4
 2 3 4 1 4 2 3 1 1 4 2 3 3 4 1 2 1 3 4 2 2 3 4 1
 4 1 3 2 3 4 1 2 3 4 2 1 3 1 4 2 4 3 1 2 1 2 3 4 :
 3 3 3 3 1 1 1 1 2 2 2 2 3 3 3 3 1 1 1 1 2 2 2 2
 2 2 2 2 3 3 3 3 1 1 1 1 3 3 3 3 2 2 2 2 1 1 1 1
 2 2 2 2 1 1 1 1 3 3 3 3 1 1 1 1 2 2 2 2 3 3 3 3 :
156 118 140 105 111 130 174 157 117 114 161 141
104  70  89 117 122  74  89  81 103  64 132 133
108 126 149  70 144 124 121  96  61 100  91  97
109  99  63  70  80  94 126  82  90 100 116  62
 96  60  89 102 112  86  68  64 132 124 129  89
118  53 113  74 104  86  89  82  97  99 119 121 :
VCOMPONENTS   [FIXED=Variety*Nitrogen] Blocks/Wplots/Subplots
REML          [PRINT=means] Yield
TABLE         [CLASSIFICATION=Variety] Comp1; VALUES=!(1,0,-1)
TABLE         [CLASSIFICATION=Nitrogen] Comp2; VALUES=!(-1,0.25,0.25,0.5)
TABLE         [CLASSIFICATION=Variety,Nitrogen] Comp3,Comp4;\
              VALUES=!(1,0,0,0, -1,0,0,0, 0,0,0,0),\
              !(1,0,0,0, 0,0,0,0, 0,0,0,-1)
PRINT         Comp1
&             Comp2
&             Comp3
&             Comp4
VTCOMPARISONS Comp1,Comp2,Comp3,Comp4
Updated on June 14, 2019

Was this article helpful?