Atlas
statminds
Nonparametric (Omnibus Rank Model)The underlying model family class (e.g. GLM, linear model, categorical matrix, log-linear).Parametric ReferenceStatistical methods that assume a specific probability distribution family (typically normal).12-stage workflow

Kruskal-Wallis H Test

The engine for Robust Multi-Group Discovery. This model audits the stochastic differences between three or more independent groups, providing a powerful omnibus shield when ANOVA assumptions fail.

Model familyNonparametric (Omnibus Rank Model)
Hypothesisomnibus
AliasesOne-Way ANOVA on Ranks · Non-Parametric Omnibus Test · H-Test for Multi-Sample Discovery
G1
Omnibus Rank Audit
Determine if at least one group mean-rank significantly deviates from the collective average.
G2
Categorical Robustness
Shield discovery from the influence of non-normal distributions and heterogeneous variances across multiple groups.
G3
Ordinal Discovery Strike
Isolate group differences in ranked or ordered data where means lack clinical justification.
Visual Overview Dashboard
1

What is it?

Kruskal-Wallis H Test is a nonparametric method comparing 3+ independent groups based on overall ranks. Alternative to One-Way ANOVA.

2

When to use it

  • Three or More Groups: Independent categorical grouping.
  • Non-Normal scale: Skewed scores or ordinal metrics violating ANOVA constraints.
3

Core Idea

Combines and ranks all data jointly. Evaluates the variance of rank sums across groups. Large variance indicates true group differences:

G1G2G3
4

Hypotheses

H0: All group distributions are stochastically identical
Ha: At least one group dominates stochastically
5

How it works

  1. Pool all observations together and sort to assign ranks.
  2. Calculate Rank Sums for each group (R1, R2, R3).
  3. Compute Kruskal-Wallis H statistic based on rank sums.
  4. Find p-value using Chi-Square distribution with df = k - 1.
6

Assumptions

📊 Ordinal Scale: Outcomes are rankable.
👤 Independence: Subjects belong to unrelated groups.
7

Effect Size

Epsilon-squared (**e2 = H / ((N^2-1)/(N+1))**) represents the proportion of rank variance attributable to group membership.

8

Quick Example

GroupnRank Sum
G11092.0
G210165.0
G310208.0
Interactive Sandbox

Kruskal-Wallis Live Laboratory

Adjust individual group averages to observe stochastic separation and Chi-square probability shift.

Presets
Group 1 Mean45.0
Group 2 Mean50.0
Group 3 Mean55.0
Group size (N)10
Jointly ranked observations by group (G1: amber, G2: blue, G3: green)Values mapped on Y-axis (vertical position represents overall rank)
123456789101112131415161718192021222324252627282930
Calculations Output
GroupRank SumRank Mean
Group 111011.0
Group 213513.5
Group 322022.0
H-statistic8.5806
p-value (ChiSq df=2)0.0080
Statistical Verdict
✅ Significant Difference
At least one group stochastically dominates (H = 8.581, p = 0.0080). Reject H0.
The 12-Stage Precision Workflow
01Global Rank Parity
Hypotheses
We test the null of 'Identical Distributions' across all groups against the discovery of a non-random rank shift.
02Distributional Homogeneity
Assumptions
The 'Shape Mandate': If groups share the same shape, we test Medians. If not, we test Stochastic Dominance (Mean Ranks).
03focus
Checking the frequency of identical values; the H-statistic requires an adjustment for ties to maintain its mathematical authority.
04focus
Comparing recovery ranks across FlowMotion, Traditional Yoga, and Usual Care in a large, non-normal clinical cohort.
05ANOVA Pivot
Alternatives
Knowing when to return to one-way ANOVA if the data is normal and the groups are large—reclaiming the higher precision of the mean.
06The H-Strike
Significance
Calculating the total discrepancy between group rank-sums and the global expectation—yielding the definitive H-statistic.
07Epsilon-Squared
Effect Size
Quantifying the proportion of total rank variance captured by your categorical groupings (η²_H).
08Group Balancing
Sample Size
Determining the N per group required to detect shifts in messy data, ensuring no group is too small to contribute to the rank-sum.
09The Omnibus Statement
Reporting
Reporting the result clearly: 'H(df) = X.XX, p = .XXX', alongside mean ranks for every category.
10Kruskal.test Logic
Software
Executing the 'kruskal.test' command, ensuring the formula interface correctly maps groups to ranks.
11Dunn's Strike
Post-hoc
Using Dunn's Test or Conover-Iman to find the 'True Winner' while protecting the global alpha from Type I inflation.
12focus
Tracing the model back to Kruskal and Wallis (1952) and the expansion of the Wilcoxon logic to the multi-group world.
01Hypothesis test logic

Hypotheses

Pragmatic null and alternative hypotheses defined in mathematical notation.

A hypothesis is a question sharpened to a point. Ambiguity is the enemy of inference.
Logic Core
Null · H₀

H₀: All k distributions are identical

Alternative · Hₐ

Hₐ: At least one distribution differs (stochastic dominance)

Why it matters omnibus

Nonparametric alternative to one-way ANOVA. Tests distributions (not means). Only interpretable as median test if group distributions have similar shapes.

02Model diagnostics

Assumptions

The core mathematical criteria needed to ensure that statistical testing remains unbiased and valid.

Build your analysis on rock, not sand. Verify the mathematical foundation before building the model.
Integrity Shield
7
Assumptions
0
Critical / High Severity
How to check
Inspect variable type; verify meaningful ordering
If violated
If nominal (no ordering) → use chi-square test of independence
How to check
Confirm study design; count unique group values
If violated
If 2 groups only → Mann-Whitney U. If repeated measures → Friedman test. If IV continuous → Spearman correlation
How to check
Design review; check no subject appears in multiple groups
If violated
If repeated measures → Friedman test. If clustered → use rank-based methods with cluster adjustment or LMM
How to check
Quick
Visual inspection: boxplots, density plots per group; compare IQRs (should be similar). Check if distributions have same variance and skewness across groups
Rigorous
Levene's test for equal variances; compare skewness coefficients across groups (difference <0.5); overlay density plots to assess shape similarity. If distributions differ in shape, K-W tests stochastic dominance, not medians
If violated
If shapes differ: K-W tests distributions (stochastic dominance via ranks), NOT medians. Report as 'distributions differ' not 'medians differ'. For pure median test when shapes differ, use Mood's median test or quantile regression at 50th percentile. If you need to test means with non-normal data, use permutation ANOVA or robust ANOVA with trimmed means
quantile regression
How to check
Quick
Boxplots by group; identify values >3 IQR beyond quartiles; check if outliers are isolated to one group
Rigorous
Identify outliers using IQR method or z-scores (|z| > 3). Assess if outliers are balanced across groups or concentrated in one group (which can bias rank sums)
If violated
First verify outliers are not data errors. If legitimate: (1) Report results with and without outliers (sensitivity analysis); (2) K-W is generally robust to outliers due to ranks, but extreme outliers can still influence results; (3) Use trimmed rank tests or permutation tests for severe outliers
How to check
Quick
Check n per group: if all groups have n ≥ 5, chi-square approximation is accurate. Total N should be ≥ 15-20 for reliable results
Rigorous
For small samples (any group n < 5), use exact Kruskal-Wallis test (exact permutation distribution). For very small samples (N < 15), consider Fisher's exact test for ordinal data or exact permutation tests
If violated
If any group has n < 5: (1) Use exact Kruskal-Wallis test (available in R: kruskal.test() with simulate.p.value=TRUE, or coin package); (2) Use permutation test with exact p-value; (3) Consider combining with another study (meta-analysis) if effect is important; (4) Be cautious with interpretation and report exact p-values. With very small samples, power is low regardless of test choice
How to check
Quick
Boxplots by group; identify values >3 IQR beyond quartiles
Rigorous
Calculate z-scores within groups; flag |z| > 3. Check if removing outliers changes H statistic by >10%
If violated
If extreme outliers present: (1) Investigate data quality (entry errors?); (2) Winsorize to 5th/95th percentiles; (3) Report results with/without outliers (sensitivity analysis); (4) Consider robust rank-based tests (e.g., trimmed ranks); (5) Transform outcome if skewness is cause. Document all decisions.
03Residual Forensics

Diagnostics

Checking residual plots and indices to examine model deviations and ensure standard error integrity.

Trust, but verify. The outliers often hold more truth than the averages.
System Health
Essential checks
  1. Visual comparison of distributions (boxplots by group)
  2. Check for similar distribution shapes (density plots, violin plots)
  3. Levene's test for homogeneity of variance (if p > .05, shapes likely similar)
  4. Effect size calculation (epsilon squared: ε² = (H - k + 1)/(n - k), interpretation: .01 small, .06 medium, .14 large)
  5. Check for monotonic trend if groups have natural ordering (Jonckheere-Terpstra test)
Recommended checks
  1. Compare skewness coefficients across groups (difference < 0.5 indicates similar shapes)
  2. Compare IQRs across groups (similar IQRs suggest similar spreads)
  3. Check proportion of tied ranks (if > 10%, verify software uses tie correction)
  4. Outlier detection (IQR method or z-scores > 3)
  5. Shapiro-Wilk test per group to confirm non-normality (justifies using K-W over ANOVA)
  6. Overlay density plots to visually assess shape similarity
  7. Sensitivity analysis: Compare results with/without top 5% extreme values
  8. Check distribution shapes are similar (overlay density plots, compare skewness across groups)
  9. Variance ratio test: Largest group variance / smallest group variance (should be < 3:1 for robust interpretation)
04Live Instances

Applied Minds

Review concrete study examples, data layout guidelines, and copy executable syntax scripts.

Theory is the map. Practice is the terrain. Simulation bridges the gap.
Applied Wisdom
Example 01

Yoga Style Effects on Flexibility (3 Independent Groups)

Research question: Do different yoga styles (Hatha, Vinyasa, Yin) differentially improve flexibility? Design: Between-subjects (n=90, 30 per group). Outcome: Sit-and-reach test (cm, continuous but right-skewed). K-W used because flexibility data violated normality (skewed distribution with floor effects).

GroupsHatha · Vinyasa · Yin
Total n90
Outcome ScaleFlexibility improvement (cm, continuous, right-skewed)
# ==============================================================================
# Kruskal-Wallis Test: Yoga Style Effects on Flexibility
# Research Question: Do different yoga styles improve flexibility differently?
# ==============================================================================

library(tidyverse)      # Data manipulation and visualization
library(rstatix)        # Statistical tests and effect sizes
library(FSA)            # Dunn's test
library(car)            # Levene's test
library(effectsize)     # Effect size calculations
library(ggpubr)         # Publication-ready plots
library(moments)        # Skewness calculation

# Generate simulated data (n = 90, 30 per group)
set.seed(2025)
data <- data.frame(
  yoga_style = rep(c("Hatha", "Vinyasa", "Yin"), each=30),
  flexibility_gain = c(
    rgamma(30, shape=3, scale=2.5),   # Hatha: moderate gains, skewed
    rgamma(30, shape=3.5, scale=2.8), # Vinyasa: moderate-high
    rgamma(30, shape=4, scale=3.2)    # Yin: highest gains
  )
)

# Convert to factor for proper ordering
data$yoga_style <- factor(data$yoga_style, levels = c("Hatha", "Vinyasa", "Yin"))

# ==============================================================================
# STEP 1: DESCRIPTIVE STATISTICS
# ==============================================================================

# Summary statistics by group
descriptives <- data %>%
  group_by(yoga_style) %>%
  summarise(
    n = n(),
    median = median(flexibility_gain),
    IQR = IQR(flexibility_gain),
    mean = mean(flexibility_gain),
    sd = sd(flexibility_gain),
    min = min(flexibility_gain),
    max = max(flexibility_gain)
  )
print("Descriptive Statistics by Group:")
print(descriptives)

# ==============================================================================
# STEP 2: ASSUMPTION CHECKING
# ==============================================================================

cat("\n=== ASSUMPTION CHECKS ===\n")

# Assumption 1: Check normality per group (Shapiro-Wilk)
cat("\n1. Normality tests(Shapiro-Wilk per group):\n")
normality_tests <- data %>%
  group_by(yoga_style) %>%
  summarise(shapiro_p = shapiro.test(flexibility_gain)$p.value)
print(normality_tests)
cat("Interpretation: If p < .05, data are non-normal → KW appropriate\n")

# Assumption 2: Check homogeneity of variance (Levene's test)
cat("\n2. Levene's Test for Homogeneity of Variance:\n")
levene_result <- leveneTest(flexibility_gain ~ yoga_style, data=data)
print(levene_result)
cat("Interpretation: If p > .05, variances are similar → can interpret as median test\n")

# Assumption 3: Check distribution shapes (compare skewness)
cat("\n3. Skewness by group(should be similar for median interpretation):\n")
skewness_by_group <- data %>%
  group_by(yoga_style) %>%
  summarise(skewness = skewness(flexibility_gain))
print(skewness_by_group)
cat("Interpretation: If skewness differs <0.5, shapes similar → median test valid\n")

# Assumption 4: Check for extreme outliers
cat("\n4. Outlier Detection(values > 3 IQR beyond Q1/Q3):\n")
outliers <- data %>%
  group_by(yoga_style) %>%
  identify_outliers(flexibility_gain)
if(nrow(outliers) > 0) {
  print(outliers)
} else {
  cat("No extreme outliers detected.\n")
}

# ==============================================================================
# STEP 3: VISUALIZATIONS
# ==============================================================================

cat("\n=== GENERATING VISUALIZATIONS ===\n")

# Visualization 1: Boxplot with individual points
p1 <- ggplot(data, aes(x=yoga_style, y=flexibility_gain, fill=yoga_style)) +
  geom_boxplot(alpha=0.7, outlier.shape=NA) +
  geom_jitter(width=0.2, alpha=0.3, size=2) +
  stat_summary(fun=median, geom="point", shape=23, size=4, fill="red") +
  labs(title="Flexibility Gains by Yoga Style",
       subtitle="Red diamond = median",
       x="Yoga Style", y="Flexibility Gain(cm)") +
  theme_minimal() +
  theme(legend.position="none")
print(p1)

# Visualization 2: Violin plots showing distribution shapes
p2 <- ggplot(data, aes(x=yoga_style, y=flexibility_gain, fill=yoga_style)) +
  geom_violin(alpha=0.6, trim=FALSE) +
  geom_boxplot(width=0.1, fill="white", alpha=0.8) +
  labs(title="Distribution Shapes: Flexibility by Yoga Style",
       x="Yoga Style", y="Flexibility Gain(cm)") +
  theme_minimal() +
  theme(legend.position="none")
print(p2)

# Visualization 3: Density plots overlayed (check shape similarity)
p3 <- ggplot(data, aes(x=flexibility_gain, fill=yoga_style)) +
  geom_density(alpha=0.5) +
  labs(title="Density Distributions by Yoga Style",
       subtitle="Check for similar shapes(CRITICAL for median interpretation)",
       x="Flexibility Gain(cm)", y="Density") +
  theme_minimal()
print(p3)

# ==============================================================================
# STEP 4: KRUSKAL-WALLIS TEST
# ==============================================================================

cat("\n=== KRUSKAL-WALLIS H TEST ===\n")

# Main test
kw_result <- kruskal.test(flexibility_gain ~ yoga_style, data=data)
print(kw_result)

# Extract test statistics
H_stat <- kw_result$statistic
df <- kw_result$parameter
p_value <- kw_result$p.value

cat(sprintf("\nH(%d) = %.2f, p = %.4f\n", df, H_stat, p_value))

# ==============================================================================
# STEP 5: EFFECT SIZE
# ==============================================================================

cat("\n=== EFFECT SIZE ===\n")

# Epsilon squared (preferred, less biased than eta squared)
epsilon_sq <- kruskal_effsize(data, flexibility_gain ~ yoga_style)
print(epsilon_sq)

cat("\nInterpretation: ε² = .01 (small), .06 (medium), .14 (large)\n")

# ==============================================================================
# STEP 6: POST-HOC TESTS (Only if p < .05)
# ==============================================================================

if(p_value < 0.05) {
  cat("\n=== POST-HOC TESTS: Dunn's Test with Bonferroni Correction ===\n")
  
  # Dunn's test (preferred for Kruskal-Wallis follow-up)
  dunn_results <- dunn_test(data, flexibility_gain ~ yoga_style, 
                            p.adjust.method="bonferroni")
  print(dunn_results)
  
  # Alternative: FSA package Dunn test
  cat("\nAlternative: FSA::dunnTest\n")
  dunn_fsa <- dunnTest(flexibility_gain ~ yoga_style, data=data, method="bonferroni")
  print(dunn_fsa)
  
  # Pairwise medians for interpretation
  cat("\nPairwise Median Comparisons:\n")
  pairwise_medians <- data %>%
    group_by(yoga_style) %>%
    summarise(median = median(flexibility_gain)) %>%
    arrange(desc(median))
  print(pairwise_medians)
  
} else {
  cat("\nKruskal-Wallis not significant(p > .05). Post-hoc tests not needed.\n")
}

# ==============================================================================
# STEP 7: FINAL INTERPRETATION
# ==============================================================================

cat("\n=== INTERPRETATION ===\n")
cat(sprintf(
  "A Kruskal-Wallis H test showed a significant difference in flexibility gains\n"))
cat(sprintf(
  "across yoga styles, H(%d) = %.2f, p = %.4f, ε² = %.2f (large effect).\n",
  df, H_stat, p_value, epsilon_sq$effsize))
cat("\nPost-hoc Dunn tests revealed Yin yoga produced significantly greater\n")
cat("flexibility gains than both Hatha and Vinyasa, with no difference between\n")
cat("Hatha and Vinyasa. Distribution shapes were similar across groups(Levene's\n")
cat("p > .05, similar skewness), validating interpretation as a median test.\n")
cat("\nConclusion: Yin yoga is most effective for flexibility improvement.\n")

# ==============================================================================
# APA REPORTING TEMPLATE
# ==============================================================================

cat("\n=== APA-STYLE REPORTING ===\n")
cat("A Kruskal-Wallis H test was conducted to compare flexibility gains across\n")
cat("three yoga styles(Hatha, Vinyasa, Yin). Distributions had similar shapes\n")
cat("across groups(Levene's test p = .XX, similar skewness), validating\n")
cat("interpretation as a test of medians. There was a significant difference\n")
cat(sprintf("in flexibility gains, H(%d) = %.2f, p < .001, ε² = %.2f (large effect).\n",
    df, H_stat, epsilon_sq$effsize))
cat("Post-hoc Dunn tests with Bonferroni correction showed Yin yoga(Mdn = XX.X cm)\n")
cat("produced greater gains than Hatha(Mdn = XX.X cm, p = .002) and Vinyasa\n")
cat("(Mdn = XX.X cm, p = .045), with no difference between Hatha and Vinyasa\n")
cat("(p = .32). Yin yoga is recommended for flexibility improvement.\n")
Interpretation Blueprint

H(2) = 18.45, p < .001, ε² = .21 (large). Post-hoc Dunn tests: Yin > Hatha (p = .002), Yin > Vinyasa (p = .045), no difference Hatha vs Vinyasa (p = .32). Yin yoga produced greatest flexibility gains. Non-normal data justified nonparametric test.

05Tactical Pivots

Alternatives

Structured fallback pathways for choosing alternative tests when normality or slopes requirements fail.

When the path is blocked, pivot. Rigor is not rigidity; it is the intelligent adaptation to reality.
Adaptive Strategy
Measurement Precision Ladder Ideal · Ordinal / Ranked Groups
Ratio
Consider One-Way ANOVA if distributions are normal. Omnibus rank comparison ignores the weight of numerical gaps.
Precision Loss
Interval
Maintain Kruskal-Wallis. Ideal for Multi-Group Scales with non-normal residuals or extreme variance shifts.
Standard Robustness
Ordinal
Maintain logic. The definitive engine for auditing stochastic rank-parity across populations.
Peak Signal
Nominal
Abandon ranks. Use Chi-Square Independence or Cramer's V to model multi-category associations.
Identity Loss
Temporal Trajectory Audit Static Multi-Group Snapshot
Static Ranks
Cross-sectional audit.
Stay with Kruskal-Wallis. Identify if at least one group consistently outranks the others.
Matched Ranks
Trajectory growth.
Pivot to Friedman Test to model within-subject rank shifts over time.
Adaptive Technical Safeguards · adaptive safeguards
normality met
  • One-Way ANOVA — Return to the mean-based strike to maximize statistical power.
ordered categorical groups
  • Jonckheere-Terpstra Test — Exploit the group-order to increase trend-detection precision.
  • Cochran-Armitage Strike — Audit the linear slope of proportions across the ranked categories.
extreme cell imbalance
  • Brunner-Munzel Test — The robust alternative when group variances and distribution shapes differ wildly.
06Adjusted Comparisons

Post-hoc

Group mean comparisons and correction controls (e.g. Tukey HSD, Bonferroni) to protect against Family-Wise Error Rates.

The omnibus test opens the door; post-hoc analysis explores the room.
Forensic Detail
Adjusted Comparisons

Post-hoc pairwise tests defined for this model.


Correction methods
Dunn's Test (The Nonparametric Standard)Conover-Iman Test (Higher Power for Factorials)Pairwise Mann-Whitney U with Bonferroni StrikeNemenyi Test (for Global Rank Parity)
Interpretation Guidelines

A significant Kruskal-Wallis result is only an invitation to a deeper audit. Use Dunn's test to find the definitive winner while protecting your global scientific integrity.

07Standardized scale impact

Effect Size

Understanding effect sizes (e.g., Cohen's d, Partial Eta-Squared) and clinical impact benchmarks.

Significance is noise. Magnitude is the signal. Measure the impact, not just the probability.
Impact Magnitude

ε² = (H - k + 1)/(n - k), where H = Kruskal-Wallis statistic, k = number of groups, n = total sample size. Interpretation: .01 small, .06 medium, .14 large (Cohen, 1988). Represents proportion of total variance in ranks explained by groups.

η² = (H - k + 1)/(n - 1). Alternative to ε²; slightly different denominator. Interpretation same as ε².

For pairwise post-hoc comparisons: r_rb = 1 - (2U)/(n₁n₂), where U = Mann-Whitney U statistic. Ranges -1 to +1. Interpretation: |r| = .1 small, .3 medium, .5 large.

For pairwise comparisons: δ = (n_greater - n_less)/(n₁n₂). Proportion of pairs where group 1 > group 2 minus proportion group 2 > group 1. Ranges -1 to +1. Interpretation: |δ| < .147 negligible, .147-.33 small, .33-.474 medium, >.474 large (Romano et al., 2006).

Recommended Metric: Report ε² for omnibus test (Kruskal-Wallis H) and Cliff's delta for pairwise post-hoc comparisons. Epsilon squared preferred over eta squared for consistency with parametric ANOVA reporting.
Small
0.2
Medium
0.5
Large
0.8
0.50
Report ε² for omnibus test (Kruskal-Wallis H) and Cliff's delta for pairwise post-hoc comparisons. Epsilon squared preferred over eta squared for consistency with parametric ANOVA reporting.
Recommended Measure
4
Available Metrics
ReportUse Report ε² for omnibus test (Kruskal-Wallis H) and Cliff's delta for pairwise post-hoc comparisons. Epsilon squared preferred over eta squared for consistency with parametric ANOVA reporting. to represent clinical impact magnitude.
08Statistical Power

Sample Size

Guidelines for minimum sample requirements and power analysis parameters.

An underpowered study is an ethical failure. Respect the data by collecting enough of it.
Power Protocol
Floor Requirements

Omnibus Rank Mandate: A minimum of 20 participants per group is required to stabilize the H-statistic and ensure the mean-rank distribution reaches statistical authority.

Effect SizeParametersRequired n
Small Effectf=.10 (Small)n ≈ 1060 total
Medium Effectf=.25 (Medium)n ≈ 175 total
Large Effectf=.40 (Large)n ≈ 72 total
Key considerations

The 'Shape Assumption': Kruskal-Wallis is most powerful when group distributions share the same shape (e.g., all skewed right). If shapes vary wildly, the test shifts from 'Median Comparison' to 'Stochastic Dominance', which may require larger samples to interpret.

G*Power StrategyBenchmark: F-tests → ANOVA on ranks (3 groups). Parameters: Effect size f (equivalent), α = .05, Power = .80. Note: Kruskal-Wallis efficiency is ~95% of one-way ANOVA, requiring a 5% increase in N for the same power.
09APA narrative blueprint

Reporting

How to compile statistical results into publication prose matching APA and journal style guides.

Data does not speak for itself. It requires a translator. Be clear, be precise, be honest.
Narrative Arc
Worked APA paragraph example
A Kruskal-Wallis H test was conducted to compare [outcome variable] across [k] groups: [list groups]. The test revealed a statistically significant difference in [outcome] ranks across the [k] groups, H(df) = X.XX, p = .XXX, ε² = .XX (medium effect size), indicating that group membership explained approximately XX% of the variance in [outcome] ranks. Post-hoc pairwise comparisons using Dunn's test with Bonferroni correction (α = .05/m) revealed that [Group A] (Mdn = XX, IQR = XX-XX) had significantly higher [outcome] than [Group B] (Mdn = XX, IQR = XX-XX), Cliff's δ = X.XX, p = .XXX, while no significant difference was found between [Group B] and [Group C], p = .XX. Distribution shapes were similar across groups as assessed by visual inspection of boxplots and comparison of skewness coefficients (Group A: XX, Group B: XX, Group C: XX), supporting interpretation of median differences.
Reusable template

A Kruskal-Wallis H test was conducted to compare outcome across k groups: list groups. State assumption checks: 'Distributions had similar shapes across groups (visual inspection)' OR 'Distributions differed in shape, so test interpreted as stochastic dominance'. There was a significant/non-significant difference in outcome across groups, H(df) = X.XX, p = .XXX, ε² = .XX interpret: small/medium/large effect. If significant: Post-hoc Dunn tests with Bonferroni correction showed describe pairwise comparisons with medians/IQRs and p-values. Conclude with interpretation.

Essential statistics to report
  • H statistic
  • degrees of freedom (k-1)
  • p-value
  • effect size (epsilon squared or eta squared)
  • medians and IQRs per group
  • post-hoc test results if significant
  • statement about distribution shapes (for interpretation)
10Exhibit Builder

Manuscript Lab

Copy standard summary tables and forensic reporting grids to outline analysis details.

Table 1: Kruskal-Wallis H Test for Non-Parametric Group Differences
GroupMedianMean RankH (χ²)dfpε² (Eta-Squared)
Method A8572.415.422.001.13
Method B7260.1
Control6548.5
Note. N = 120 (40 per group). Dependent variable: Productivity Rank.
H (15.42)Confirms Group Separation. At least one group has a significantly different rank distribution than the others.
Mean Rank (72.4 vs 48.5)Identifies the Leader. Method A clearly dominates the rankings compared to the Control group.
Header glossary

The Rank Variance. Measures how much the average ranks of the groups deviate from what we would expect if they were all the same.

Rank Variance Explained. .13 indicates that 13% of the variability in ranks is directly attributable to the Grouping factor.

11Algorithmic Logic

Command Center

Syntax libraries and function parameters for executing calculations in stats packages.

Code is the modern laboratory. Clean execution ensures reproducible discovery.
Execution Engine
# 1. Execute Kruskal-Wallis Test
kruskal.test(score ~ group, data = df)

# 2. Extract Effect Size (Eta-Squared)
rstatix::kruskal_effsize(score ~ group, data = df)

# 3. Post-hoc Rank Comparisons (Dunn's Test)
dunn.test::dunn.test(df$score, df$group, method = 'bh')
Library stack
R
statsdunn.testrstatix
Python
scipy.statspingouin
Elite Forensic Strike

Kruskal-Wallis is 'Omnibus'. It tells you THERE IS a difference, but not WHERE. You MUST follow up with Dunn's test (not Mann-Whitney) to find the specific group pairs.

# Execute Nemenyi Post-hoc (Conservative rank-sum comparison)
PMCMRplus::kwAllPairsNemenyiTest(score ~ group, data = df)
12The Over-adjustment Trap

Common Mistakes

Analytical caveats and corrections to maintain modeling integrity.

Wisdom is learning from the failures of others. Anticipate the error before it occurs.
Defensive Logic
Why it's wrong
Kruskal-Wallis tests whether distributions differ via rank sums (stochastic dominance), NOT whether medians differ. It ONLY tests medians when groups have similar distribution shapes (same variance and skewness). If Group A is wider/more skewed than Group B, significant K-W means distributions differ, not necessarily medians. This is the same issue as Mann-Whitney (Divine et al., 2018). The null hypothesis is 'all k distributions are identical', NOT 'all k medians are equal'. See one_way_anova.json common mistake #7 for detailed explanation.
The correction
ALWAYS check distribution shapes: overlay boxplots/density plots, compare IQRs and skewness. If shapes SIMILAR (Levene's p > .05, similar skewness) → interpret as median test. If shapes DIFFER → report as 'distributions differ' or 'stochastic dominance'. For pure median test when shapes differ, use Mood's median test. For mean test with non-normality, use permutation ANOVA. Reference Divine et al. (2018): nonparametric rank tests fail as median tests when shapes differ.
Why it's wrong
K-W is an omnibus test (like ANOVA): tells you 'at least one group differs' but not which pairs. Without post-hoc tests, you cannot identify specific group differences. Reporting only H statistic is incomplete and prevents actionable conclusions.
The correction
If K-W p < .05, ALWAYS run post-hoc tests: Dunn test with Bonferroni/Holm correction (preferred), or pairwise Mann-Whitney with adjustment. Report specific pairwise comparisons: 'Dunn post-hoc tests showed Group A > Group B (p = .003) and Group A > Group C (p = .015), with no difference between B and C (p = .42)'.
Why it's wrong
Running multiple Mann-Whitney tests (e.g., 3 pairwise tests for 3 groups) inflates familywise Type I error. With 3 groups and α=.05 per test, error rate ≈ 1-(1-.05)³ = 14%, not 5%. This violates assumption of controlled error rate.
The correction
For 3+ groups: (1) Run omnibus Kruskal-Wallis first; (2) Only if K-W p < .05, proceed to post-hoc tests (Dunn or Mann-Whitney) with adjustment. Never run pairwise tests without omnibus test + adjustment. Use Dunn test (designed for K-W follow-up) or Bonferroni-adjusted Mann-Whitney.
Why it's wrong
p-value indicates significance, not magnitude. With large n, trivial differences can be 'significant'. Effect size answers 'How large is the difference?' Essential for interpreting practical importance and meta-analysis.
The correction
ALWAYS report effect size: epsilon squared (ε², preferred, less biased) or eta squared (η²). Interpret: ε² = .01 (small), .06 (medium), .14 (large). Example: 'H(2) = 18.45, p < .001, ε² = .21 (large effect)'. Calculate in R: rstatix::kruskal_effsize() or effectsize::rank_epsilon_squared().
Why it's wrong
K-W requires INDEPENDENT groups. For repeated measures (same subjects at multiple time points) or matched data, independence assumption is violated. Using K-W inflates Type I error and loses power by ignoring within-subject correlation.
The correction
For repeated measures (3+ time points, same subjects): use Friedman test (nonparametric RM-ANOVA). For matched/blocked data: use Friedman test or Skillings-Mack test. Always verify: each subject appears in exactly ONE group (independent) vs. MULTIPLE measurements (repeated).
Why it's wrong
K-W is designed for 3+ groups. With only 2 groups, it's mathematically equivalent to Mann-Whitney U but unnecessarily complex. Mann-Whitney provides more direct interpretation and commonly used effect sizes (rank biserial, CLES).
The correction
For 2 independent groups: use Mann-Whitney U test (clearer interpretation, established effect sizes). For 3+ groups: use Kruskal-Wallis. In R: if 2 groups, wilcox.test(paired=FALSE) = Mann-Whitney. If 3+ groups, kruskal.test().
Why it's wrong
Tied ranks (identical values) reduce variability in rank sums, which can slightly inflate Type I error. With many ties (>10% of data), standard K-W approximation may be inaccurate. Most software auto-corrects for ties, but severe ties (e.g., many zeros, ceiling effects) indicate measurement issues.
The correction
Check proportion of ties: count duplicates / total n. If <10%, standard K-W is fine (software uses tie correction). If >10% ties: (1) Ensure software applies tie correction (most do automatically); (2) Consider exact test or permutation test; (3) Investigate measurement scale—severe ties may indicate insensitive measure or need for different analysis (e.g., ordinal regression).
Why it's wrong
If data are normally distributed with equal variances, ANOVA is more powerful than K-W (higher power to detect true effects). K-W has ~95% efficiency vs. ANOVA for normal data. Using K-W unnecessarily reduces power by ~5%, increasing risk of false negatives.
The correction
ALWAYS check normality first (Shapiro-Wilk per group, Q-Q plots) and homogeneity of variance (Levene's test). If both met (p > .05) AND no severe outliers → use one-way ANOVA (more powerful). If violated → use K-W. Don't default to nonparametric without checking assumptions.
Why it's wrong
K-W tests ranks, not means. Even when distribution shapes are similar, K-W tests medians (not means). If you report 'mean differences' after K-W, you're misinterpreting the test. ANOVA tests means; K-W tests distributions/medians (depending on shape similarity). Confusing these leads to incorrect conclusions—e.g., two groups could have identical medians but different means if distributions are skewed.
The correction
After K-W, report MEDIANS and IQRs (not means and SDs) if shapes are similar. Report 'median difference' not 'mean difference'. If you need to test means with non-normal data, use permutation ANOVA or robust ANOVA with trimmed means. Only report means if data are approximately normal (in which case, why not use ANOVA?). Be clear about what the test is actually testing: 'K-W tests whether distributions differ' or 'K-W tests whether medians differ (given similar shapes)'.
13Academic Lineage

References

Scholarly lineage and citation keys grounding the statistical framework.

We stand on the shoulders of giants. Honor the source of the method.
Academic Lineage
[1]
Kruskal, W. H., & Wallis, W. A. (1952). Use of ranks in one-criterion variance analysis. Journal of the American Statistical Association, 47(260), 583-621.
Original paper introducing the Kruskal-Wallis test as a nonparametric alternative to one-way ANOVA.
doi: 10.1080/01621459.1952.10483441
[2]
Divine, G. W., Norton, H. J., Barón, A. E., & Juarez-Colunga, E. (2018). The Wilcoxon–Mann–Whitney procedure fails as a test of medians. The American Statistician, 72(3), 278-286.
Critical paper explaining that rank-based tests (including Kruskal-Wallis) test for stochastic dominance/distribution differences, NOT medians. Only interpretable as median test when distribution shapes are similar.
doi: 10.1080/00031305.2017.1305291
[3]
Dunn, O. J. (1964). Multiple comparisons using rank sums. Technometrics, 6(3), 241-252.
Dunn's test for post-hoc pairwise comparisons following significant Kruskal-Wallis test.
doi: 10.1080/00401706.1964.10490181
[4]
Romano, J., Kromrey, J. D., Coraggio, J., & Skowronek, J. (2006). Appropriate statistics for ordinal level data: Should we really be using t-test and Cohen's d for evaluating group differences on the NSSE and other surveys? In annual meeting of the Florida Association of Institutional Research (pp. 1-33).
Guidelines for effect sizes with ordinal data, including Cliff's delta interpretation thresholds.
[5]
Tomczak, M., & Tomczak, E. (2014). The need to report effect size estimates revisited. An overview of some recommended measures of effect size. Trends in Sport Sciences, 1(21), 19-25.
Overview of effect size measures for nonparametric tests, including epsilon squared for Kruskal-Wallis.
An omnibus significance is only a signal of existence, not a map of location. Never claim a specific group is superior until you have finished the post-hoc audit.
The Interpretive Rigor Directive
statminds · Kruskal-WallisMind reference · v2.2 · updated 2026-01-1715 of 15 sections