A nonparametric hypothesis test that compares three or more independent groups is the Kruskal-Wallis test.

You probably already know about one-way ANOVA, which compares the means of at least three groups, if you analyze data. The nonparametric variant of it is the Kruskal-Wallis test. The analysis makes fewer assumptions about your data than its parametric counterpart because it is nonparametric.

The Kruskal-Wallis test is frequently used by analysts to ascertain whether the medians of at least three groups are uneven. It’s crucial to remember that it only evaluates the medians in specific situations.

**What Can You Learn from the Test?**

The Kruskal Wallis test assesses data ranks at its core. All sample data are ranked by the method from low to high.

The ranks for all groups are then averaged. The average group ranks are not equal across the board if the results are statistically significant.

The analysis, therefore, shows whether any groups have values that are ranked differently. One group may, for instance, have values that tend to rank higher than those of the other groups.

Only ranks are used in the Kruskal-Wallis test; no medians or other distributional features are. In actuality, it combines the location and form factors into a single evaluation of each group’s average rank by evaluating ranks.

You can see that a group’s distribution is more likely to yield greater or lower values than the others when their average ranks are not equal.

However, you lack sufficient knowledge to make particular judgments about the positions of the distributions (such as the medians).

**Analysis Assumptions**

The Kruskal-Wallis test has assumptions, much like any statistical study. It is essential to ensure that your data conform to these presumptions.

Independent Groups: Each group is given a unique set of topics or assignments.

Every observation must be independent of every other observation. The data shouldn’t be able to anticipate or influence one another.

Ordinal or Continuous Data: The Kruskal Wallis test is adaptable for a variety of research scenarios since it can handle both ordinal and continuous data.

Same Distribution Shape: This presumption only holds true when inferring the medians. If this presumption is accurate, the study can shed light on the medians.

These presumptions can be broken, and the results can be wrong.

Free Data Science Books » EBooks »

**Ok, Now when to use these tests?**

In the following circumstances, think about applying the Kruskal Wallis test:

You have data with ordinals.

You have a small sample size and nonnormally distributed data.

The median rather than the mean is more important to your topic.

Even with nonnormal data, one-way ANOVA may be appropriate if there are 3 to 9 groups and more than **15** observations per group, or 10 to 12 groups and more than **20** observations per group. The sampling distributions converge on normality as a result of the central limit theorem, making ANOVA a **good** option.

Compared to the Kruskal-Wallis test, one-way ANOVA has the following benefits:

More capability in statistics to find disparities.

Can handle different-shaped distributions (Utilise Welch’s ANOVA).

Avoids the interpreting problems mentioned above.

Utilize this nonparametric technique, in other words, if you want to focus on the medians, have ordinal data, or can’t utilize one-way ANOVA due to a small, nonnormal sample.