Dunn's Test Calculator

Perform nonparametric multiple comparison tests after a significant Kruskal–Wallis test.Enter your group data, and get rank sums, z-scores, raw and adjusted p-values (Bonferroni, Holm, or Benjamini–Hochberg), effect sizes (Cliff's Delta), and significance flags. Ideal for biological, medical, and social science research.

Load example:
? Plant growth (4 groups)
? Drug efficacy (3 groups)
? Exam scores (5 groups)
Your data stays local: All computations run in your browser. No data is sent to any server.

What Is Dunn's Test and When Should You Use It?

Dunn's test (also known as Dunn's post-hoc test or Dunn's multiple comparison test) is a nonparametric procedure for pairwise multiple comparisons following a significant Kruskal–Wallis test. Developed by Olive Jean Dunn in 1964, it is widely used in biomedical research, ecology, psychology, and any field where data do not meet the normality assumptions required by ANOVA.

While the Kruskal–Wallis test tells you whether at least one group differs from the others, it does not identify which groups differ. Dunn's test fills this gap by performing all pairwise comparisons while controlling the family-wise error rate — typically via the Bonferroni correction or other adjustments such as Holm or Benjamini–Hochberg.

For two groups i and j, the Dunn's test statistic is:

zij = ( RiRj ) / sqrt( ( N(N+1)/12 − ΣT / (N(N−1)) ) · ( 1/ni + 1/nj ) )

where Ri is the mean rank of group i, N is total sample size, ni is group size, and ΣT is the tie correction factor.

Key Assumptions and Properties

  • Nonparametric: No assumption of normality is required.
  • Independent groups: Observations are independent between and within groups.
  • Ordinal or continuous data: The test uses ranks, so it works with ordinal data and is robust to outliers.
  • Homogeneity of variances: While the Kruskal–Wallis test does not strictly require equal variances, Dunn's test is more reliable when variances are similar across groups.
  • Tie handling: Average ranks are assigned to tied observations, with a correction factor applied to the variance.

Why Use an Interactive Dunn's Test Calculator?

  • Instant results: No need to manually rank data or look up critical values.
  • Educational value: See the step-by-step ranking and computation process.
  • Research ready: Get publication-quality output with adjusted p-values and significance stars.
  • Exploratory analysis: Quickly test different grouping schemes or data subsets.
  • Completely free and private: All calculations run locally in your browser.

Step-by-Step Algorithm

  1. Combine and rank: All observations from all groups are pooled and sorted. Ties receive the average of the ranks they occupy.
  2. Compute rank sums: For each group k, sum the ranks of its observations (Rk) and compute the mean rank Rk = Rk / nk.
  3. Kruskal–Wallis H: Calculate the overall H statistic to confirm global significance. H = [12 / (N(N+1))] · Σ (Rk2 / nk) − 3(N+1), with tie correction.
  4. Pairwise z statistics: For every pair of groups (i, j), compute zij using the formula above. The denominator uses the pooled variance of the ranks.
  5. p-values: Convert each z to a two-tailed p-value using the standard normal distribution.
  6. Multiple comparison correction: Apply the selected correction (Bonferroni, Holm, or Benjamini–Hochberg) to control the family-wise error rate or FDR.
  7. Significance flags: Mark comparisons with adjusted p < 0.05 as significant.

Real-World Applications

Case Study: Agricultural Field Trial

A researcher tests four fertilizer formulations on crop yield. The Kruskal–Wallis test reveals a significant difference (H = 11.2, p = 0.011). Using Dunn's test with Bonferroni correction, the researcher finds that Formulation A yields significantly higher than Formulation C (adj. p = 0.023) and Formulation D (adj. p = 0.041), but not Formulation B (adj. p = 0.31). This targeted information guides the selection of the best fertilizer while controlling the risk of false positives.

Case Study: Clinical Trial with Multiple Treatments

In a four-arm clinical trial comparing a new drug, an existing drug, a placebo, and a no-treatment control, patient recovery scores are ordinal. After a significant Kruskal–Wallis result, Dunn's test identifies that the new drug is significantly better than placebo (adj. p = 0.008) and no-treatment (adj. p = 0.012), but not significantly different from the existing drug (adj. p = 0.34). This informs the clinical significance and comparative effectiveness of the new therapy.

Comparison with Other Post-Hoc Tests

Method Type Correction When to Use
Dunn's test Nonparametric Bonferroni / Holm / Benjamini–Hochberg After Kruskal–Wallis, when data are ordinal or non-normal
Conover test Nonparametric Bonferroni / Holm Similar to Dunn's but uses a different variance estimator
Nemenyi test Nonparametric Tukey All pairwise comparisons, often used with Friedman test
Tukey HSD Parametric Tukey After ANOVA, when data are normal and variances are homogeneous
Bonferroni correction General Bonferroni Can be applied to any set of comparisons; conservative

Frequently Asked Questions

The Kruskal–Wallis test is an omnibus test that determines whether any group differs from the others. Dunn's test is a post-hoc test that identifies which specific pairs of groups differ, while controlling the Type I error rate across multiple comparisons.

Absolutely. Dunn's test can handle any number of groups (typically 3 or more). The number of pairwise comparisons grows as k(k−1)/2, so the Bonferroni correction becomes more conservative as the number of groups increases.

The calculator uses average ranks for tied observations and applies a tie correction factor in the variance calculation. This makes the test robust to ties, though very heavy ties can reduce power. The tie correction is automatically applied.

Bonferroni is the simplest and most widely understood correction. It controls the family-wise error rate by dividing the significance level by the number of comparisons. While conservative, it is appropriate for confirmatory analyses. For exploratory work, you may consider less conservative methods like Holm or Benjamini–Hochberg.

Yes. The calculator is optimized for moderate-sized datasets (up to a few thousand observations total). Performance may degrade with very large datasets due to the O(N log N) sorting step, but for typical research data it runs instantly.

Statistical rigor and transparency – This tool implements Dunn's test as described in Dunn (1964) "Multiple Comparisons Using Rank Sums" (Technometrics, 6:241–252) and follows the computational methods recommended by the R package dunn.test and the Python library scikit-posthocs. The code has been reviewed for numerical accuracy and adherence to established statistical practice. Last updated July 2026.

References: Dunn, O.J. (1964). Multiple Comparisons Using Rank Sums. Technometrics, 6(3):241–252. JSTOR | Kruskal, W.H. & Wallis, W.A. (1952). Use of Ranks in One-Criterion Variance Analysis. J. Amer. Statist. Assoc., 47(260):583–621.