Kruskal-Wallis test


The Kruskal-Wallis test (H-test) is an extension of the Wilcoxon test and can be used to analyse the effect of a classification factor on ordinal data. It tests the hypothesis that a number of unpaired samples originate from the same population.

Required input

  • Variable: select a continuous variable.

  • Factor codes: select a categorical or qualitative variable. This variable may either contain character or numeric codes. These codes are used to break-up the data into several subgroups.
  • Optionally select a filter to include a subset of cases.


  • Post-hoc test significance level: the desired significance level for the post-hoc test. If the Kruskal-Wallis test results in a P-value less than this significance level, performs a post-hoc test.
  • Jonckheere-Terpstra trend test: when the qualitative factor is ordered the Jonckheere-Terpstra trend test can be used to test the hypothesis that the medians are ordered (increase or decrease) according to the order of the qualitative factor (Bewick et al., 2004; Sheskin 2011).


If the null-hypothesis, being the hypothesis that the samples originate from the same population, is rejected (P<0.05), then the conclusion is that there is a statistically significant difference between at least two of the subgroups.

Post-hoc analysis

If the Kruskal-Wallis test is positive (P less than the selected significance level) then performs a test for pairwise comparison of subgroups.


  • Altman DG (1991) Practical statistics for medical research. London: Chapman and Hall.
  • Bewick V, Cheek L, Ball J (2004) Statistics review 10: further nonparametric methods. Critical Care 8:196-199.
  • Conover WJ (1999) Practical nonparametric statistics, 3rd edition. New York: John Wiley & Sons.
  • Dunn OJ (1964) Multiple comparisons using rank sums. Technometrics 6:241-252.
  • Rosner B (2006) Fundamentals of Biostatistics. 6th ed. Pacific Grove: Duxbury.
  • Sheskin DJ (2011) Handbook of parametric and nonparametric statistical procedures. 5th ed. Boca Raton: Chapman & Hall /CRC.

See also


Go to Kruskal-Wallis test.