Skip to content
Celeus

Kruskal-Wallis test

Shown in the app as kruskal_wallis. Part of the method reference, under Comparing groups.

When to use

3+ independent groups, continuous/ordinal outcome, non-normal.

What you provide

  • Outcome: one numeric column.
  • Group: one categorical column.

Options

Missing data

  • Complete case (listwise deletion)
  • Mean imputation (single)
  • Median imputation (single)

Multiple comparisons

  • Holm
  • Benjamini-Hochberg (false discovery rate)
  • Bonferroni
  • None (unadjusted)

Confidence level

Every interval in the result is reported at the level you choose:

  • 90%
  • 95%
  • 99%

Alternatives that take the same inputs:

Other methods under Comparing groups:

Guides that discuss this method

How to read the output

These methods compare one outcome across three or more independent groups, for example crop yield under four irrigation schedules, or test scores across several schools.

The overall test. The p-value answers one question: is there any difference among the groups? A small p-value does not say which groups differ or by how much. One-way ANOVA assumes equal variances across groups; Welch’s ANOVA does not; the Kruskal-Wallis test works on ranks and does not assume normality.

Effect size. For the two ANOVAs, eta-squared is the proportion of the outcome’s variation that lies between the groups, from 0 to 1. For Kruskal-Wallis, epsilon-squared plays the same role on ranks. Both come with a two-sided confidence interval; the epsilon-squared interval is a seeded bootstrap, so the same data always give the same interval. The reproducible script recomputes the effect size and its interval too.

Groups coded as numbers. A group column stored as numbers (1, 2, 3) is still treated as a set of labels, never as a measurement. When missing values are filled with a mean or median, a missing group code is not filled, because the mean of two codes is not a group; that row is left out instead.

Which groups differ. With three or more groups, Celeus adds pairwise comparisons, each corrected for making several comparisons at once: Tukey’s honestly significant difference after one-way ANOVA, the Games-Howell procedure after Welch’s ANOVA (it does not assume equal variances either), and Dunn’s test after Kruskal-Wallis, where you choose the correction (Holm by default). Read each pair’s adjusted p-value and its effect size together; a pair can differ reliably by a trivial amount.

Options. Every interval of a run (the effect size, the Tukey intervals and each pair’s effect size) uses one confidence level: 90%, 95% (the default) or 99%. The overall test has no one-sided version: it asks whether any group differs, which has no direction.

Sources: Tukey JW (1949), Biometrics 5(2):99-114, doi:10.2307/3001913. Games PA, Howell JF (1976), Journal of Educational Statistics 1(2):113-125, doi:10.3102/10769986001002113. Dunn OJ (1964), Technometrics 6(3):241-252, doi:10.1080/00401706.1964.10490181.

Worked examples

Celeus's result on a published or illustrative dataset, next to an independent computation and, where one exists, a published value. The data themselves are not reproduced here.

datasets::ToothGrowth

  • Source: Published dataset distributed with an R package
  • Licence: base R (GPL)
  • Reference: Crampton (1947)
QuantityCeleusIndependent computationPublished valueAgrees
p-value1.47521e-091.47521e-09-Yes
Effect size0.6893040.689304-Yes

datasets::InsectSprays

  • Source: Published dataset distributed with an R package
  • Licence: base R (GPL)
  • Reference: Beall (1942), Biometrika 32(3/4):243-262 (the data); independent computation
QuantityCeleusIndependent computationPublished valueAgrees
Test statistic54.691354.6913-Yes
Degrees of freedom55-Yes
p-value1.51084e-101.51084e-10-Yes
Effect size0.7703010.770301-Yes
Multiplicity correction for the pairwise comparisonsbonferronibonferroni-Yes

datasets::airquality (Ozone by Month)

  • Source: Published dataset distributed with an R package
  • Licence: base R (GPL)
  • Reference: Chambers et al. (1983), Graphical Methods for Data Analysis (the data); independent computation
QuantityCeleusIndependent computationPublished valueAgrees
Test statistic29.266629.2666-Yes
Degrees of freedom44-Yes
p-value6.90071e-066.90071e-06-Yes
Number of observations116116-Yes
Effect size0.2544920.254492-Yes

datasets::warpbreaks (breaks by tension)

  • Source: Published dataset distributed with an R package
  • Licence: base R (GPL)
  • Reference: Tippett (1950), Technological Applications of Statistics (the data); independent computation
QuantityCeleusIndependent computationPublished valueAgrees
Test statistic10.809310.8093-Yes
Degrees of freedom22-Yes
p-value0.004495710.00449571-Yes
Effect size0.2039480.203948-Yes
Confidence level of the effect size interval0.90.9-Yes

Validation report

References

  1. Kruskal, W. H., Wallis, W. A. (1952). Use of ranks in one-criterion variance analysis. Journal of the American Statistical Association 47: 583-621. doi:10.1080/01621459.1952.10483441 doi:10.1080/01621459.1952.10483441