ArticleslgStudy

mathematics

Kruskal–Wallis test

Kruskal–Wallis test is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Kruskal–Wallis test rather than just read about it. In short: The Kruskal–Wallis test by ranks, Kruskal–Wallis H {\displaystyle H} test (named after William Kruskal and W. Allen Wallis), or one-way ANOVA on ranks is a non-parametric statistical test for testing whether samples originate from the same distribution.

Kruskal–Wallis test — main illustration
Kruskal–Wallis test — illustration

Key takeaways

  • Kruskal–Wallis test belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Kruskal–Wallis test to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Kruskal–Wallis test from memory before moving on to harder problems.

Reference excerpt

The Kruskal–Wallis test by ranks, Kruskal–Wallis H {\displaystyle H} test (named after William Kruskal and W. Allen Wallis), or one-way ANOVA on ranks is a non-parametric statistical test for testing whether samples originate from the same distribution. It is used for comparing two or more independent samples of equal or different sample sizes. It extends the Mann–Whitney U test, which is used for comparing only two groups. The parametric equivalent of the Kruskal–Wallis test is the one-way analysis of variance (ANOVA). A significant Kruskal–Wallis test indicates that at least one sample stochastically dominates one other sample. The test does not identify where this stochastic dominance occurs or for how many pairs of groups stochastic dominance obtains. For analyzing the specific sample pairs for stochastic dominance, Dunn's test, pairwise Mann–Whitney tests with Bonferroni correction, or the more powerful but less well known Conover–Iman test are sometimes used. It is supposed that the treatments significantly affect the response level and then there is an order among the treatments: one tends to give the lowest response, another gives the next lowest response is second, and so forth. Since it is a nonparametric method, the Kruskal–Wallis test does not assume a normal distribution of the residuals, unlike the analogous one-way analysis of variance. If the researcher can make the assumptions of an identically shaped and scaled distribution for all groups, except for any difference in medians, then the null hypothesis is that the medians of all groups are equal, and the alternative hypothesis is that at least one population median of one group is different from the population median of at least one other group. Otherwise, it is impossible to say, whether the rejection of the null hypothesis comes from the shift in locations or group dispersions. This is the same issue that happens also with the Mann-Whitney test. If the data contains potential outliers, if the population distributions have heavy tails, or if the population distributions are significantly skewed, the Kruskal–Wallis test is more powerful at detecting differences among treatments than ANOVA F-test. On the other hand, if the population distributions are normal or are light-tailed and symmetric, then ANOVA F-test will generally have greater power which is the probability of rejecting the null hypothesis when it indeed should be rejected.

Method

Rank all data from all groups together; i.e., rank the data from 1 to N ignoring group membership. Assign any tied values the average of the ranks they would have received had they not been tied. The test statistic is given by

H = ( N − 1 ) ∑ i = 1 g n i ( r ¯ i ⋅ − r ¯ ) 2 ∑ i = 1 g ∑ j = 1 n i ( r i j − r ¯ ) 2 , {\displaystyle \definecolor {Orange}{rgb}{1,0.5019607843137255,0}\definecolor {ChromeYellow}{rgb}{1,0.6549019607843137,0.011764705882352941}\definecolor {Green}{rgb}{0,0.5019607843137255,0}\definecolor {green}{rgb}{0,0.5019607843137255,0}\definecolor {Blue}{rgb}{0,0,1}\definecolor {Purple}{rgb}{0.5019607843137255,0,0.5019607843137255}H=({\color {Red}N}-1){\frac {\sum _{i=1}^{\color {Orange}g}{\color {ChromeYellow}n_{i}}({\color {Blue}{\bar {r}}_{i\cdot }}-{\color {Purple}{\bar {r}}})^{2}}{\sum _{i=1}^{\color {Orange}g}\sum _{j=1}^{\color {ChromeYellow}n_{i}}({\color {Green}r_{ij}}-{\color {Purple}{\bar {r}}})^{2}}},} where

N {\textstyle \color {Red}N} is the total number of observations across all groups

g {\textstyle \definecolor {Orange}{rgb}{1,0.5019607843137255,0}\color {Orange}g} is the number of groups

… excerpt ends here. Continue reading the full article.

Illustrations

Kruskal–Wallis test: Difference between ANOVA and Kruskal–Wallis test with ranks
Difference between ANOVA and Kruskal–Wallis test with ranks
Kruskal–Wallis test: An illustration of how to assign any tied values the average of the rank
An illustration of how to assign any tied values the average of the rank
Kruskal–Wallis test illustration

Worked examples

Example 1 — a first encounter with Kruskal–Wallis test

Start with the simplest possible case. Write down what Kruskal–Wallis test claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Kruskal–Wallis test before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Kruskal–Wallis test ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Kruskal–Wallis test

In research
Kruskal–Wallis test appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Kruskal–Wallis test in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Kruskal–Wallis test is common in secondary-school and first-year university syllabi. It links to neighbouring topics Analysis of variance, Nonparametric statistics, Statistical tests, so understanding it makes those chapters shorter.
In everyday life
Look for Kruskal–Wallis test outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Kruskal–Wallis test” →

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Kruskal–Wallis test in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Kruskal–Wallis test means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Kruskal–Wallis test out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Kruskal–Wallis test in simple terms?

The Kruskal–Wallis test by ranks, Kruskal–Wallis H {\displaystyle H} test (named after William Kruskal and W. Allen Wallis), or one-way ANOVA on ranks is a non-parametric statistical test for testing whether samples originate from the same distribution.

Why does Kruskal–Wallis test matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Kruskal–Wallis test?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Kruskal–Wallis test.

Tags

  • Analysis of variance
  • Nonparametric statistics
  • Statistical tests

Keep exploring