Method document
Sample size for a Kruskal–Wallis test of an ordinal outcome
How many participants are needed to show that an ordinal outcome, such as a severity grade or a Likert response, is distributed differently across three or more independent groups, from the expected probability of each category in each group. Allows for ties and unequal groups. Covers dropout.
https://statwisely.com/methods/nonparametric-kruskal-wallis/
When to use it
- Comparing an ordered outcome with a few categories across three or more groups or interventions, without assuming the categories are equally spaced.
Not for
- Two groups. Use the Mann–Whitney test.
- Groups that are themselves ordered, when the question is a trend. A trend test spends its power on that one direction.
- A numerical outcome with roughly normal data. Use one-way ANOVA.
Notation
- Total number of participants
- Number of groups
- Share of participants in group i
- Probability of category j in group i
- Pooled probability of category j, Σᵢ wᵢπᵢⱼ
- Probability that a participant in group i exceeds one from the pooled sample, ties counting half
- Significance level: the chance of a false positive
- Power: the chance of detecting the effect if it is real
- Expected dropout
Formulas
How far each group sits from the pooled sample
With no difference between groups every θᵢ is ½. A group’s mean rank divided by N estimates θᵢ [1].
Noncentral chi-square power
The denominator is the tie correction to the Kruskal–Wallis statistic: an outcome with few categories has many ties and needs more participants. With two groups λ is the tie-corrected Mann–Whitney formula [2]. The first group gets the smallest whole number reaching the power, and each other group that number times its relative size.
Dropout
Applied last, to the participants actually recruited.
Parameters
Expected category probabilities in each group
Values: At least three groups with the same ordered categories (at least two); each group’s probabilities add to 1
The smallest differences between the groups worth detecting, as the share of each group expected in each category. Pilot data or a previous study is the usual source.
Relative group sizesOptional
Values: One per group, each above 0; equal if omitted
How many participants each group gets relative to the others.
Significance level
Values: Between 0 and 1; usually 0.05
The false-positive rate you accept. A smaller α, for example to allow for several primary outcomes, needs a larger sample.
Power
Values: Between 0 and 1; usually 0.80 or 0.90
The chance of a significant result if the assumed effect is real. Funders and ethics committees commonly expect at least 0.80.
Expected dropoutOptional
Values: 0% up to, but not including, 100%
The share of participants expected to provide no outcome, from comparable studies. Recruiting more restores the numbers, not the comparability of the groups: if dropout is related to the outcome, the estimate can still be biased.
Assumptions
- Participants are independent, each in exactly one group, and the outcome categories are ordered.
- The approximation uses the variance of the ranks with no group difference, as Noether’s formulas do [3]. Simulation shows it slightly conservative.
- Dropout is unrelated to the outcome; recruiting more participants restores the numbers but cannot remove bias.
Worked examples
Three groups, four categories
Outcome shares from 20/30/30/20% in the first group to 10/25/35/30% in the third: θ = 0.455, 0.495, 0.550; α = 0.05, 80% power: 164 per group, N = 492.
164 per group · Total: 492
Open this example in the calculatorProtocol statement
To detect the expected distributions of the outcome categories in each group with 80% power at a significance level of 0.05, using a Kruskal–Wallis test of an ordinal outcome across 3 groups, the required sample size is 164 per group (492 in total, across 3 groups). Calculated with StatWisely (statwisely.com) using: N: solve noncentral χ² power on k-1 df, λ=12NΣwᵢ(θᵢ-½)²/(1-Σp̄ⱼ³). These are planning estimates; confirm the final design with a qualified statistician.
Twice as many in the first group
Allocating 2 : 1 : 1: 246 in the first group and 123 in each of the others, N = 492.
group1: 246 · group2: 123 · group3: 123 · Total: 492
Open this example in the calculatorAn outcome with only two categories
Shares of 40%, 50% and 60% in the upper category: the tie correction is 0.75, and 121 per group, N = 363.
121 per group · Total: 363
Open this example in the calculatorValidation
- Every worked example on this page is recomputed by the StatWisely engine whenever the software is built. If a number or formula here stopped matching the calculator, the release would be stopped until this document was corrected.
- An independent implementation in R recomputes this test every night and before each production release, and the results are compared with the engine’s.
- No published software result was available to compare with, so the sizes were checked by simulation: 20,000 trials of R’s kruskal.test at each planned size gave power of 0.806 (three groups, four categories), 0.806 (2 : 1 : 1), 0.805 (two categories) and 0.820 (four groups), each against a target of 0.80. With two groups the formula reduces exactly to the tie-corrected Mann–Whitney formula [2].
How to cite
StatWisely. Sample size for a Kruskal–Wallis test of an ordinal outcome. Method document, engine version 1.0.0, reviewed 2026-10-04. https://statwisely.com/methods/nonparametric-kruskal-wallis/
Cite the original references for the formulas your design uses as well.
References
- 1.Lehmann EL. Nonparametrics: Statistical Methods Based on Ranks. San Francisco: Holden-Day; 1975.
- 2.Zhao YD, Rahardja D, Qu Y. Sample size calculation for the Wilcoxon–Mann–Whitney test adjusting for ties. Statistics in Medicine. 2008;27(3):462–468. doi:10.1002/sim.2973
- 3.Noether GE. Sample size determination for some common nonparametric tests. Journal of the American Statistical Association. 1987;82(398):645–647.