Example: Multiple Comparisons Test

A multiple-comparisons analysis is performed using data discussed by Kirk (1982, pp. 123-125). 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).

import com.imsl.stat.*;
import com.imsl.math.PrintMatrix;

public class MultipleComparisonsEx1 {
    public static void main(String args[]) {
        double[] means = {36.7, 48.7, 43.4, 47.2, 40.3};
        
        /* Perform multiple comparisons tests */
        MultipleComparisons mc = new MultipleComparisons(means, 45, 1.6970563);
        
        new PrintMatrix("Size of Groups of Means").print(mc.compute());
    }
}

Output

Size of Groups of Means
   0  
0  3  
1  3  
2  3  
3  0  

Link to Java source.