Talk:Kruskal–Wallis test

Assumptions on type of data missed
It would be good to mention what types of data this can be applied to. eg: numerical vs. ordinal vs. categorical vs. binary? — Preceding unsigned comment added by Drevicko (talk • contribs) 04:54, 28 February 2023 (UTC)

Meaning of significance is misstated
The statement "A significant Kruskal–Wallis test indicates that at least one sample stochastically dominates one other sample" is already false for the Wilcoxon-Mann-Whitney test the Kruskal-Wallis is meant to extend to more than two samples. It could then only be true if the model were specified to "equal or at least stochastically ordered" or similar, or if Kruskal-Wallis were not an extension of Wilcoxon-Mann-Whitney.

Have forgotten how to log in; I am Lutz Mattner. — Preceding unsigned comment added by 2003:C0:8F0A:CD00:7306:7998:C852:DB14 (talk) 09:50, 23 January 2023 (UTC)

Null Hypothesis is misstated
The Kruskal-Wallis test is designed to detect stochastic dominance, so the null hypothesis is the absence of stochastic dominance. Using multi-modal distributions you can quickly generate counter examples to the claim "the null hypothesis of the Kruskal-Wallis is equal distribution of the samples". For example, if you have three sets of samples with the same median but from a uni-modal, bi-modal, and tri-modal distribution respectively, then necessarily the Kruskal-Wallis test will fail to reject the null hypothesis, as there is no stochastic dominance. Yet this does not indicate the samples are from the same distribution. — Preceding unsigned comment added by 198.161.4.94 (talk) 16:59, 21 June 2018 (UTC)

Disagreement
Response: Don't lose site of the assumptions. This test is performed under the assumption that the distributions all have the same shape. The assumption is not tested in a hypothesis test, rather the hypothesis is. The assumptions are there to let us know when the method is supposed to work. So your example of three differently shaped distributions does not qualify as a counter example to any inference drawn by applying this test. The test shouldn't be applied in your setting.

Secondly, regarding the statement of the null hypothesis, one could argue that it is commonly misinterpreted, but I wouldn't agree that it is misstated. If we really are (that's what an assumption means) acquiring data from k data generating processes that can only differ in their location, then a test of common location can be based on their medians. The standard null hypothesis is that all the distributions have the same median. It could just as well be that they all have the same 10th percentile, or the same mean since when the distributions have the same shape they have the same 10th percentiles and the same means etc. I've heard people say the Kruskal-Wallis test only compares medians and that it can't be used to compare means. That is a misinterpretation of the null hypothesis since under the assumptions (so when the distributions really have the same shape and can only differ in their locations) by rejecting the claim that they all have the same median, we are also rejecting that they all have the same 10th percentile and that they all have the same mean etc.2601:183:C801:A350:5D2D:6EA3:7E3A:7E32 (talk) 01:47, 10 September 2021 (UTC)some joe2601:183:C801:A350:5D2D:6EA3:7E3A:7E32 (talk) 01:47, 10 September 2021 (UTC)

Untitled
The formula of the test statistic K is unnecessarily complicated. There is a much simpler form:


 * $$K = \frac{12}{n(n+1)}\sum_{i=1}^m n_i\left(R_{i\cdot} - \frac{n+1}{2}\right)^2=\frac{12}{n(n+1)}\sum_{i=1}^m \left(\frac 1{n_i} \left(\sum_{j=1}^{n_i} R_{ij}\right)^2 \right) - 3(n+1)$$

Nijdam 21:17, 18 August 2006 (UTC)

Does the Kruskal-Wallis test rely on an assumption of Homoscedasticity (equal variances)? I've found conflicting references on the web which state both sides.

It is stated that the Kruskal-Wallis test does not require the populations to be normal nor does it require them to have equal variability; the article then says that this is a limitation. This is very misleading, as these properties are usually seen as advantages, allowing an ANOVA-like analysis to be performed even when the assumptions of the parametric ANOVA are violated. The limitation is that non-parametric tests typically have less statistical power than parametric tests (i.e. they require some combination of larger sample sizes and effect sizes to reach the equivalent power of parametric tests).130.88.246.109 09:15, 9 May 2007 (UTC)

not testing medians
the kruskal-wallis test does not test the significance of medians between samples, it tests the means. So this sentence is wrong: "In statistics, the Kruskal-Wallis one-way analysis of variance by ranks (named after William Kruskal and W. Allen Wallis) is a non-parametric method for testing equality of population medians among groups" —Preceding unsigned comment added by 71.76.4.55 (talk) 03:18, 4 October 2007 (UTC)

I'd just like to second this. This really does need to be changed in the main page. Every year we have large numbers of students who, though having been told not to rely on Wikipedia, report test results by stating that there was a significant difference in median x between groups. Can someone who knows how, change the damn site please? I am amazed it has been left for so long considering how often the page must be viewed. Cheers. — Preceding unsigned comment added by 92.234.168.111 (talk) 11:22, 22 November 2012 (UTC)


 * Both the above comments are in error. The Kruskal-Wallis test is, in its most general application, a test of the null hypothesis that there is no stochastic dominance between any of the groups tested (i.e. H0: P(Xi > Xj) = 0.5 for all groups i and j, with HA: P(Xi > Xj) ≠ 0.5 for at least one i ≠ j). These hypotheses, and this test are not about means. I have cleaned up the article to refer correctly to stochastic dominance.--Lexy-lou (talk) 15:56, 23 July 2014 (UTC)

I still have problem with the sentence in introduction : "If the researcher can make the less stringent 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." If we can make this assumption, both medians and means are valid. In most cases, it is difficult to make this assumption and then KS does not test median but Stochastic dominance as described above. As example, if the sample S1 is {0 0 0 0 10  20 20 20 20} and the sample S2 is {1 1 1 1  10  21 21 21 21}, S1 and S2 have the same median 10 but P(S2>S1)+0.5*P(S2=S1) is greater than 0.5. So KS will reject whereas the two distributions have the same median. I think the sentence is misleading since KS does not particularly deals with median.

not testing means or medians.
The null hypothesis is that all populations have the same distribution. Kruskal-Wallis assumes that the errors in observations are i.i.d. (in the same way that parametric ANOVA assumes i.i.d. $$N(0,\sigma^2)$$ errors; Kruskal-Wallis drops only the normality assumption). The test is designed to detect simple shifts in location (mean or median - same thing here) among the populations. If one starts allowing more complicated differences between distributions (e.g. changes in shape), then all bets are off. It's easy to construct examples of populations with equal medians, or examples of populations with equal means, that will lead to inflated K-W statistics and high probability of rejection of "equality".

Not surprisingly many web sites, software manuals, texts, etc get carried away by the word "nonparametric", and make interpretations of the K-W statistic that simply aren't true.

--Zaqrfv (talk) 05:39, 12 August 2008 (UTC)

As the extension of Mann-Whitney test, the Kruskal-Wallis does not check the equality of groups' medians (which Median test does) or groups' means (which ANOVA does). It checks the overall prevalence of values (See Mann-Whitney test Wikipedia article). Sometimes this is called "difference in location", however there is no consensus as to what term "location" really means. 188.123.252.14 (talk) 07:52, 21 June 2011 (UTC)

Removed the offending sentence. What would be a more accurate statement? Max Libbrecht (talk) 06:15, 3 December 2012 (UTC)


 * The Kruskal-Wallis test is indeed, in its most general application, a test of the null hypothesis that there is no stochastic dominance between any of the groups tested (i.e. H0: P(Xi > Xj) = 0.5 for all groups i and j, with HA: P(Xi > Xj) ≠ 0.5 for at least one i ≠ j). These hypotheses, and this test are not about means. I have cleaned up the article to refer correctly to stochastic dominance.--Lexy-lou (talk) 15:56, 23 July 2014 (UTC)

Error in first formular
So far i can see the (N-1) factor in first formular is correct a (N-2) factor.

The denominator is not (N-1)*N*(N+1). The true is (N-2)*(N-1)*N.

With this we get the same conclusions as in the article.

also: it looks as though it should be sigma R^2/n, not sigma nR^2

—Preceding unsigned comment added by 217.10.60.85 (talk) 07:45, 18 May 2009 (UTC)

"g" variable is undefined in equation stating test
Every other variable seems to be explained immediately after the equation except the upper bound of the sums "g".

161.208.26.33 (talk) 15:29, 3 June 2019 (UTC)

Recent addition of example based on R documentation site
In this edit restored an edit that I had previously reverted in which the Kruskal-Wallis test is applied to a set of ozone level readings. The cited source (Chambers et al. Graphical Methods for Data Analysis) provides the data, but the analysis was unsourced, and so I reverted it as original research. Quantile restored the example, with the edit summary ''The application to the ozone data is not original research. It is taken directly from the R documentation. See for example https://www.rdocumentation.org/packages/stats/versions/3.6.2/topics/kruskal.test''. I would argue that this may not be a reliable source since R modules may be user-generated. WikiDan61 ChatMe!ReadMe!! 19:55, 16 March 2023 (UTC)