Kruskal-Wallis Demo

The following data represent 4 groups of measurements of a single factor. Note that not all waves have the same length. The Kruskal-Wallis test is a non-parametric test that uses ranks of the data to test the null hypothesis that there is no difference among groups.

wave1wave2wave3wave4
5.16.35.55.2
6.755.65.8
63.96.76.2
6.26.25.36
5.66.15.37
6.34.36.76.3
5.57.68.3

To run the test execute the following command:

StatsKWTest /T=1/Q wave1,wave2,wave3,wave4

The results are displayed in the Kruskal-Wallis Test table:

Num_Groups4
Num_Valid_Data27
Alpha0.05
H2.93763
Hc_Chi_square_approx7.81473
P_Chi_square_approx0.401342
Hc_Wallace_approx7.81984
P_Wallace_approx0.411107

The H statistic is clearly below the critical value so H0 (data in the input waves are the same) is accepted.

The following wave represents a 5th group of data for the same factor:

wave5
6.7
7.3
7
6.7
7.2
7.1
7.2

To run the test execute the following command:

StatsKWTest /T=1/Q wave1,wave2,wave3,wave5

The results are displayed in the Kruskal-Wallis Test table:

Num_Groups4
Num_Valid_Data27
Alpha0.05
H12.677
Hc_Chi_square_approx7.81473
P_Chi_square_approx0.00538994
Hc_Wallace_approx7.81984
P_Wallace_approx0.00283628

In this case the statistic H clearly indicates that H0 should be rejected but there is no indication that the variation is mostly due to wave5. To perform a multi-comparison test execute the following command:

StatsNPMCTest/T=1/DHW/Q wave1,wave2,wave3,wave5
The results are shown in the NP Multiple Comparison (DHW) table:

DiffSEQQcConclusion
wave5_vs_wave214.73814.398323.350842.638260
wave5_vs_wave111.14294.225772.636882.638261
wave5_vs_wave39.285714.225772.19742.638261
wave3_vs_wave25.452384.398321.239652.638261
wave3_vs_wave11.857144.225770.439482.638261
wave1_vs_wave23.595244.398320.8174112.638261

Checking the Q statistic we see that most of the variation is between wave5 and the other waves with maximum difference between wave5 and wave2. Note that in the last operation we used the /DHW flag because the input waves were not of the same length.