The Kruskal-Wallis test compares two or more independent groups using the ranks of continuous or ordinal observations. It is a non-parametric alternative to a one-way ANOVA when the data are not normally distributed, or when scores are ordinal. section 5.2.1
The test combines rank sums across groups, accounting for group size, to produce an H-statistic. H indicates the magnitude of a group difference, not which group has higher scores. Unlike a one-way ANOVA, the test does not assume a particular underlying distribution shape, but it has lower statistical power. section 5.2.1
Choose and interpret the test in context:
- For two independent groups, the Mann-Whitney U test is another option; for three or more dependent groups, use a test suited to dependent samples, such as the Friedman test. section 5.2.1 section 5.4
- A significant result across three or more groups does not identify the differing pairs. Follow it with corrected post hoc comparisons to limit false positives. section 5.2.1 section 5.4
Comparing assessment scores
Given three groups of assessment scores with different distribution shapes, plot their histograms, consider whether transformations make ANOVA appropriate, and run a Kruskal-Wallis test. Then examine which group scores highest and how changing sample sizes affects the result; use post hoc tests when pairwise conclusions are needed. section 5.2.2
H = st.kruskal(X1, X2, X3) print(H)
This short SciPy listing shows the test call for three independent score arrays; its returned result must still be interpreted alongside the distributions and any needed post hoc comparisons. section 5.2.2
