{"id":2013,"date":"2026-10-15T21:00:00","date_gmt":"2026-10-15T21:00:00","guid":{"rendered":"https:\/\/freestatisticaltools.com\/blog\/?p=2013"},"modified":"2026-10-15T21:00:00","modified_gmt":"2026-10-15T21:00:00","slug":"kruskal-wallis-test","status":"publish","type":"post","link":"https:\/\/freestatisticaltools.com\/blog\/kruskal-wallis-test\/","title":{"rendered":"Kruskal-Wallis Test: Nonparametric ANOVA With Dunn\u2019s Post Hoc Test"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The <strong>Kruskal-Wallis H test<\/strong> compares three or more independent groups when the outcome is ordinal or when the assumptions of a one-way ANOVA are badly violated. It is the nonparametric counterpart of the one-way ANOVA and the extension of the <a href=\"\/blog\/mann-whitney-u-test\/\">Mann-Whitney U test<\/a> to more than two groups.<\/p>\n\n\n<div class=\"fst-tool\"><span class=\"ico\"><svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.8\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M3 17h4l3-10 4 14 3-8h4\"\/><\/svg><\/span><span><span class=\"t-eyebrow\">Free tool \u00b7 runs in your browser<\/span><a class=\"t-name\" href=\"https:\/\/freestatisticaltools.com\/kruskal-wallis-test-calculator\/\" style=\"text-decoration:none;color:inherit\">Kruskal-Wallis H Test Calculator<\/a><span class=\"t-desc\">Free Kruskal-Wallis H test calculator with mean ranks, tie correction, epsilon squared and Bonferroni-adjusted Dunn post-hoc tests.<\/span><\/span><a class=\"btn accent\" href=\"https:\/\/freestatisticaltools.com\/kruskal-wallis-test-calculator\/\" data-tool=\"kruskal-wallis-test-calculator\">Run a Kruskal-Wallis test \u2192<\/a><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">When to use it<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Three or more independent groups<\/strong>, with different people in each.<\/li>\n\n<li><strong>An ordinal outcome<\/strong> (a single Likert item, a pain rating, a ranking), or a continuous outcome that is strongly skewed or has outliers in small groups.<\/li>\n\n<li>For repeated measurements on the same people, use the Friedman test instead.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">How it works<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">All observations are ranked together, from lowest to highest, ignoring group membership. The test then asks whether the average rank differs between groups more than chance would allow. The statistic H follows approximately a chi-square distribution with <i>k<\/i> \u2212 1 degrees of freedom, where <i>k<\/i> is the number of groups.<\/p>\n\n\n\n<div class=\"fst-note note\"><b>Does it compare medians?<\/b><p>Only if the groups have distributions of the same shape and spread. In general the Kruskal-Wallis test detects whether values in one group tend to be higher than in another (stochastic dominance). Report medians and IQRs as descriptives, but describe the result as a difference in distributions or ranks unless the shapes are similar.<\/p><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Assumptions<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Independent observations, each person in one group only.<\/li>\n\n<li>An outcome that is at least ordinal.<\/li>\n\n<li>For interpreting the result as a median difference, similarly shaped distributions in each group.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Worked example<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A hospital compares patient satisfaction (a 1\u201310 rating) across three wards, with 20 patients each (<i>N<\/i> = 60). The ratings are skewed, with many 9s and 10s, so ANOVA is not ideal.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Ward<\/th><th>n<\/th><th>Median<\/th><th>IQR<\/th><th>Mean rank<\/th><\/tr><\/thead><tbody><tr><td>A<\/td><td>20<\/td><td>8<\/td><td>7\u20139<\/td><td>37.7<\/td><\/tr><tr><td>B<\/td><td>20<\/td><td>7<\/td><td>5\u20138<\/td><td>21.6<\/td><\/tr><tr><td>C<\/td><td>20<\/td><td>8<\/td><td>6\u20139<\/td><td>32.2<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The test gives <i>H<\/i>(2) = <strong>8.78<\/strong>, <i>p<\/i> = <strong>.012<\/strong>. At least one ward differs from the others.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Post hoc test: Dunn&#39;s test<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A significant H only says that the groups are not all the same. To find which pairs differ, use <strong>Dunn&#39;s test<\/strong> with a correction for multiple comparisons (Bonferroni or Holm). In this example, Dunn&#39;s test with Holm correction shows that ward A rated higher than ward B (<i>p<\/i><sub>adj<\/sub> = .011), while the other pairs did not differ significantly. The free calculator runs Dunn&#39;s test automatically.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Effect size<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Two common effect sizes for Kruskal-Wallis are:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Epsilon squared<\/strong>: \u03b5\u00b2 = <i>H<\/i> \/ (<i>n<\/i> \u2212 1) = 8.78 \/ 59 = <strong>.15<\/strong><\/li>\n\n<li><strong>Eta squared based on H<\/strong>: \u03b7\u00b2<sub>H<\/sub> = (<i>H<\/i> \u2212 <i>k<\/i> + 1) \/ (<i>n<\/i> \u2212 <i>k<\/i>) = (8.78 \u2212 3 + 1) \/ 57 = <strong>.12<\/strong><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Both are interpreted roughly like \u03b7\u00b2 in ANOVA (.01 small, .06 medium, .14 large). For each significant pair, you can also report the rank-biserial correlation or <i>r<\/i> = <i>z<\/i> \/ \u221a<i>n<\/i> from the pairwise comparison.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to report it in APA 7<\/h2>\n\n\n\n<div class=\"fst-report\"><b>How to report it (APA 7)<button type=\"button\" data-copy-report>Copy<\/button><\/b><div><p>A Kruskal-Wallis test showed that satisfaction differed significantly across the three wards, <i>H<\/i>(2) = 8.78, <i>p<\/i> = .012, \u03b5\u00b2 = .15. Dunn\u2019s post hoc tests with Holm correction indicated that patients on ward A (<i>Mdn<\/i> = 8) reported higher satisfaction than patients on ward B (<i>Mdn<\/i> = 7), <i>p<\/i> = .011. No other pairwise differences were significant.<\/p><\/div><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Kruskal-Wallis or ANOVA?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">With roughly normal data and similar variances, ANOVA has more power. With moderate non-normality and 15\u201320 or more per group, ANOVA is still fairly robust. Kruskal-Wallis is the better choice for ordinal outcomes, strong skew or outliers in small samples. If variances are unequal but the data are roughly normal, Welch&#39;s ANOVA is often a better alternative than Kruskal-Wallis.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Frequently asked questions<\/h2>\n\n\n\n<div class=\"fst-faq\"><details><summary>What is the Kruskal-Wallis test used for?<\/summary><div class=\"a\"><p>It compares three or more independent groups on an ordinal or non-normal continuous outcome, as a nonparametric alternative to one-way ANOVA.<\/p><\/div><\/details><details><summary>What post hoc test should I use after Kruskal-Wallis?<\/summary><div class=\"a\"><p>Dunn\u2019s test with a Bonferroni or Holm correction. Running multiple Mann-Whitney tests without correction inflates the Type I error rate.<\/p><\/div><\/details><details><summary>How do I report Kruskal-Wallis in APA?<\/summary><div class=\"a\"><p>Report H with its degrees of freedom, the exact p-value, an effect size such as \u03b5\u00b2, medians for each group and the significant post hoc comparisons.<\/p><\/div><\/details><details><summary>What sample size do I need?<\/summary><div class=\"a\"><p>There is no strict minimum, but each group should have at least 5 observations for the chi-square approximation to work. For good power, aim for 15\u201320 or more per group.<\/p><\/div><\/details><\/div>\n\n\n<div class=\"fst-report\"><b>Cite the tool (APA 7)<button type=\"button\" data-copy-report>Copy<\/button><\/b><div>Xavier, B. (2026). <i>Kruskal-Wallis H Test Calculator<\/i> [Web application]. FreeStatisticalTools.com. https:\/\/freestatisticaltools.com\/kruskal-wallis-test-calculator\/<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Comparing three or more groups on ordinal or skewed data? How the Kruskal-Wallis H test works, how to follow it up with Dunn\u2019s test and how to report it.<\/p>\n","protected":false},"author":1,"featured_media":2014,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_fst_seo_title":"Kruskal-Wallis Test: Example, Dunn Post Hoc and APA Report","_fst_meta_desc":"The Kruskal-Wallis H test explained: when to use it instead of one-way ANOVA, assumptions, Dunn\u2019s post hoc test, effect size and APA reporting.","_fst_primary_tool":"kruskal-wallis-test-calculator","_fst_canonical":"","_fst_noindex":false,"_fst_no_toc":false,"_fst_no_autolink":false,"footnotes":""},"categories":[4],"tags":[19,81,22,87],"class_list":["post-2013","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-nonparametric-tests","tag-apa-style","tag-kruskal-wallis","tag-nonparametric","tag-post-hoc"],"_links":{"self":[{"href":"https:\/\/freestatisticaltools.com\/blog\/wp-json\/wp\/v2\/posts\/2013","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/freestatisticaltools.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/freestatisticaltools.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/freestatisticaltools.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/freestatisticaltools.com\/blog\/wp-json\/wp\/v2\/comments?post=2013"}],"version-history":[{"count":1,"href":"https:\/\/freestatisticaltools.com\/blog\/wp-json\/wp\/v2\/posts\/2013\/revisions"}],"predecessor-version":[{"id":2050,"href":"https:\/\/freestatisticaltools.com\/blog\/wp-json\/wp\/v2\/posts\/2013\/revisions\/2050"}],"wp:attachment":[{"href":"https:\/\/freestatisticaltools.com\/blog\/wp-json\/wp\/v2\/media?parent=2013"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/freestatisticaltools.com\/blog\/wp-json\/wp\/v2\/categories?post=2013"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/freestatisticaltools.com\/blog\/wp-json\/wp\/v2\/tags?post=2013"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}