1. Home
  2. MCOMPARISON procedure


Performs pairwise multiple comparison tests within a table of means (D.M. Smith).


PRINT = string tokens Controls printed output (comparisons, critical, description, lines, letters, plot, mplot, pplot); default lett
METHOD = string token Test to be performed (flsd, bonferroni, sidak); default flsd
DIRECTION = string token How to sort means (ascending, descending); default asce
PROBABILITY = scalar The required significance level; default 0.05
STUDENTIZE = string token Whether to use the alternative LSD test where the Studentized Range statistic is used instead of Student’s t (yes, no); default no


MEANS = tables or variates Means to be compared
SED = symmetric matrix or scalar Standard errors of differences of the means
DF = symmetric matrix or scalar Degrees of freedom for the standard errors of differences
VMEANS = pointer or variate Saves the means in a variate, sorted as requested by the DIRECTION option
DIFFERENCES = symmetric matrix Saves differences between the (sorted) means
LABELS = text Saves labels for the (sorted) means
LETTERS = text Saves letters indicating groups of means that do not differ significantly
SIGNIFICANCE = symmetric matrix Indicators to show significant comparisons between (sorted) means
CIWIDTH = symmetric matrix Saves the width of the confidence interval for the absolute differences between the (sorted) means
TERMNAME = texts Name of the term, to use to annotate the graphs


MCOMPARISON can be used perform all pairwise multiple comparison tests on tables of predicted means, that may be saved for example from PREDICT or VPREDICT. The methodology implemented in the procedure closely follows that described in Chapter 5 of Hsu (1996).

The MEANS parameter supplies a table containing the means to be compared. You also need to provide standard errors of differences and their degrees of freedom, using the SED and DF parameters, respectively. These can be in scalars, if they are identical for every comparison between two means. Otherwise they should be in symmetric matrices.

Printed output is controlled by the PRINT option, with settings:

comparisons prints the differences between the pair of means, upper and lower confidence limits for the differences, t-statistics and an indication of whether or not they are significant;
critical gives critical values for the t-statistic for situations where these do not vary amongst the comparisons (i.e. for the Scheffe, Bonferroni and Sidak methods, as well as the Fisher LSD methods provided all the comparisons have the same mumber of residual degrees of freedom);
description provides a description including information such as the experiment-wise and compartment-wise error rates;
lines gives the means, with lines joining those that do not differ significantly;
letters gives the means, with identical letters (a, b etc.) alongside those that do not differ significantly;
mplot does a mean-mean scatter plot (synonym plot);
displays the probabilities in a shade plot.

The means are usually sorted into ascending order, but you can set option DIRECTION=descending for descending order, or DIRECTION=* to leave them in their original order. Note, though, that the lines joining means with non-significant differences may then be broken.

If the standard errors for the differences between the means are unequal, the memberships of the groups defined by the lines or letters may be inconsistent. Suppose, for example, you have ordered means A, B and C. If the s.e.d. for A vs. C is large compared to those for A vs. B and B vs C, you might find that there is no significant difference between A and C, but there are significant differences between A and B, and between B and C. So treatments A and B and treatments B and C would be in different groups. However, treatments A and C (which are further apart) would be in the same group. This contradicts the idea behind multiple comparisons, where you expect that if two means are in the same group, then any mean between them should be in that group too. If MCOMPARISON finds inconsistencies like this, it gives a diagnostic and suppresses the printing of lines and letters (but not the other types of output).

The mean-mean scatter plot allows you to assess the confidence region for the difference between each pair of means visually. It has grid lines from both the x- and y-axis at the position of each mean, and a diagonal line at 45 degrees marking y=x. The confidence interval for each pair of means is plotted as a line at an angle of -45 degrees and centred on the intersection above the line y=x of the grid lines for the two means (so the y grid line is for the larger of the two means, and the x grid line is for the smaller mean). The difference between the means is significant if their confidence line does not intersect the line y=x. For more details, see Hsu (1996) pages 151-153.

The shade plot displays the probabilities in a symmetric matrix. The colour of each cell represents the probability for the difference between the means for the treatments in the corresponding row and column.

The type of test to be performed is specified by the METHOD option, with settings FLSD (Fisher’s Unprotected Least Significant Difference), Bonferroni and Sidak. The PROBABILITY option allows the experiment-wise significance level for the intervals from the Bonferroni and Sidak tests to be changed from the default 0.05 (e.g. to 0.01). For the Fisher’s test, it changes the pair-wise significance level.

The STUDENTIZE option can specify that the Fisher’s protected or unprotected LSD tests should use the Studentized Range statistic rather than Student’s t (for further information see Hsu 1996, page 139).

The VMEANS parameter can save the means in a variate, sorted according to the DIRECTION option and omitting any that were non-estimable. The LABELS parameter can save a text containing labels to identify the means, and the LETTERS parameter can save a text with the letters identifying means that do not differ significantly. The SIGNIFICANCE parameter can save a symmetric matrix containing ones or zeros according to whether the various comparisons were significant or non-significant. The DIFFERENCES parameter can save a symmetric matrix containing the differences between the (sorted) means, and the CIWIDTH parameter can save a symmetric matrix containing the widths of the confidence intervals for the differences.



The methodology implemented is based on that described in Hsu (1996).


Hsu, J.C. (1996). Multiple Comparisons Theory and Methods. Chapman & Hall, London.

See also



  'Damage caused by waves to forward sections of cargo-carrying ships.',\
  '(McCullagh & Nelder, 1989, Generalized Linear Models, p. 137.');\
&           [LABELS=!T('1960-64','1965-69','1970-74','1975-79')] Constrct
&           [LABELS=!T('1960-74','1975-79')] Operatn
GENERATE    Type,Constrct,Operatn
VARIATE     [NVALUES=40] Service,Damage
READ        Service,Damage
  127  0     63  0   1095  3   1095  4  1512  6   3353 18  * *  2244 11
44882 39  17176 29  28609 58  20370 53  7064 12  13099 44  * *  7117 18
 1179  1    552  1    781  0    676  1   783  6   1948  2  * *   274  1
  251  0    105  0    288  0    192  0   349  2   1208 11  * *  2051  4
   45  0      0  0    789  7    437  7  1157  5   2161 12  * *   542  1 :
" remove ships that never sailed "
SUBSET      [Service > 0] Type,Constrct,Operatn,Service,Damage
CALCULATE   Logserv = LOG(Service)
MODEL       [DISTRIBUTION=poisson; LINK=log; OFFSET=Logserv] Damage
TERMS       [FACTORIAL=2] Type * Constrct * Operatn
FITINDIVIDUALLY [PRINT=model,estimates,accumulated; FPROBABILITY=yes]\
            Type + Constrct + Operatn
CAPTION  !t('Make the comparisons on the transformed scale, as it is there',\
            'that the predictions have approximate Normal distributions.')
RKEEP       DF=Rdf
MCOMPARISON Tpredict; SED=Tsed; DF=Rdf
Updated on September 2, 2019

Was this article helpful?