Statistical Calculators › Means: Many Groups (ANOVA) › Kruskal-Wallis Test Sample Size Calculator
← All Calculators

Means: Many Groups (ANOVA)

Kruskal-Wallis Test Sample Size Calculator

Estimate the sample size required for a Kruskal-Wallis test comparing multiple independent groups. This calculator uses Monte Carlo simulation of the Kruskal-Wallis rank statistic under the null and alternative distributions, following the simulation approach used by PASS. Runs entirely in your browser.

Study Design

Specify the target power, significance level, and the distributions expected under the alternative hypothesis.
Alternative distributions
Group
Mean
SD

Sample Size Result

The smallest equal group size whose simulated power reaches the requested target.
Enter the study parameters and click Calculate Sample Size.

Methodology

The Kruskal-Wallis test is the rank-based, non-parametric analogue of the one-way analysis of variance for comparing multiple independent groups. For sample-size planning, PASS provides a dedicated Kruskal-Wallis Tests (Simulation) procedure rather than relying on a single closed-form normal-theory sample-size formula.

This calculator follows that simulation framework. For each candidate sample size, it generates independent observations from the user-specified alternative distributions, ranks all observations together, calculates the Kruskal-Wallis statistic, and records the proportion of simulations that reject the null hypothesis.

Kruskal-Wallis statistic

H = [12 / (N(N + 1))] × Σ(Rj2 / nj) − 3(N + 1)
where Rj is the sum of the ranks in group j and N is the total sample size.

Under the null hypothesis, all groups are generated from the same distribution. The null simulations establish the empirical rejection threshold at the requested alpha level. The alternative simulations use the group-specific distributions entered by the user. Estimated power is the proportion of alternative simulations whose Kruskal-Wallis statistic exceeds that null threshold.

Sample-size search

Candidate equal group sizes are evaluated sequentially from the specified minimum through the specified maximum. The calculator returns the first group size whose simulated power is at least the requested target power.

Total N = number of groups × sample size per group
Estimated Power = alternative simulations rejecting H0 / total alternative simulations

Important interpretation

Because this is a simulation-based procedure, estimated power has Monte Carlo variability. Increasing the number of simulations makes the estimate more stable. PASS's published examples use 5,000 simulations per run, which is also the default here.

The test itself is non-parametric, but sample-size planning still requires an assumed data-generating distribution under the alternative hypothesis. The normal distributions used by the worked validation example below are therefore simulation assumptions, not an assumption that the eventual Kruskal-Wallis analysis must use a normal-theory test.

Validation example

The calculator was checked against the published PASS example using four equal-sized groups with means 9.775, 12, 12, and 14.225, a common standard deviation of 3, alpha = 0.05, and target power = 0.80. PASS reports that a sample size of 12 per group gives approximately 0.801 power.

Groups = 4
Means = 9.775, 12, 12, 14.225
SD = 3 for every group
Alpha = 0.05
Target power = 0.80
PASS result = n = 12 per group, N = 48
Clinical Biostats fixed-seed simulation = n = 12 per group, N = 48

The exact simulated power will vary somewhat with the random seed and number of Monte Carlo repetitions. The validation target is therefore the sample-size decision, with the published PASS example identifying 12 subjects per group as the required equal allocation for 80% power.

References

NCSS, LLC. (2026). Kruskal-Wallis Tests (Simulation). PASS Sample Size Software Documentation, Chapter 556. The PASS documentation describes the simulation procedure, its inputs, output, worked examples, and validation examples.

Fan, C., Zhang, D., & others (2010). “On sample size of the Kruskal-Wallis test with application to a mouse peritoneal cavity study.” Statistics in Medicine. 29(23), 2464–2473. This paper discusses alternative power and sample-size approaches for the Kruskal-Wallis test and emphasizes that power depends on the underlying distributions rather than solely on the number of groups.

Official PASS documentation: Kruskal-Wallis Tests (Simulation)