MULTICOMP Function
Performs Student-Newman-Keuls multiple-comparisons test.
Usage
result = MULTICOMP(means, df, std_error)
Input Parameters
means—One-dimensional array containing the means.
df—Degrees of freedom associated with std_error.
std_error—Effective estimated standard error of a mean. In fixed effects models, std_error equals the estimated standard error of a mean.
For example, in a one-way model:
where s2 is the estimate of σ2 and n is the number of responses in a sample mean. In models with random components, use:
where sedif is the estimated standard error of the difference of two means.
Returned Value
result—A one-dimensional array of length N_ELEMENTS(means) indicating the size of the groups of means declared to be equal. If the ith element of the returned array is equal to j, then the ith smallest mean and the next   j – 1 larger means are declared equal. If the ith element of the returned array is equal to 0, then no group of means starts with the ith smallest mean.
Input Keywords
Double—If present and nonzero, then double precision is used.
Alpha—Significance level of test. Must be in the interval [0.01, 0.10]. Default: Alpha = 0.01
lsd—If present and nonzero, then uses the Least significant difference method.
tukey—If present and nonzero, then uses the Tukey's w-procedure, also called the honestly significant difference procedure.
bonferonni—If present and nonzero, then uses the Bonferonni t statistic.
Discussion
Function MULTICOMP performs a multiple-comparison analysis of means using the Student-Newman-Keuls method. The null hypothesis is equality of all possible ordered subsets of a set of means. This null hypothesis is tested using the Studentized range of each of the corresponding subsets of sample means. The method is discussed in many elementary statistics texts, e.g., Kirk (1982, pp. 123–125).
Example
A multiple-comparisons analysis is performed using data discussed by Kirk. The results show that there are three groups of means with three separate sets of values: (36.7, 40.3, 43.4), (40.3, 43.4, 47.2), and (43.4, 47.2, 48.7).
df = 45 
std_error = 1.6970563 
means = [36.7, 48.7, 43.4, 47.2, 40.3] 
equal_means = MULTICOMP(means, df, std_error) 
PM, equal_means, Title = 'Size of groups of means:' 
 
; This results in the following output:
 
; Size of groups of means: 
;   3 
;   3 
;   3 
;   0