Skip to main content

    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.

    Engine version 1.0.0 · Reviewed 4 October 2026

    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

    NN
    Total number of participants
    kk
    Number of groups
    wiw_i
    Share of participants in group i
    πij\pi_{ij}
    Probability of category j in group i
    πˉj\bar{\pi}_j
    Pooled probability of category j, Σᵢ wᵢπᵢⱼ
    θi\theta_i
    Probability that a participant in group i exceeds one from the pooled sample, ties counting half
    α\alpha
    Significance level: the chance of a false positive
    1−β1-\beta
    Power: the chance of detecting the effect if it is real
    qq
    Expected dropout

    Formulas

    How far each group sits from the pooled sample

    θi=∑jπij(∑l<jπˉl+12πˉj)\theta_i = \sum_{j} \pi_{ij}\left(\sum_{l<j} \bar{\pi}_l + \tfrac{1}{2}\bar{\pi}_j\right)

    With no difference between groups every θᵢ is ½. A group’s mean rank divided by N estimates θᵢ [1].

    Noncentral chi-square power

    Pr⁡ ⁣(χk−1,λ′2>χk−1, 1−α2)≥1−β,λ=12N∑iwi(θi−12)21−∑jπˉj3\Pr\!\left(\chi'^{2}_{k-1,\lambda} > \chi^{2}_{k-1,\,1-\alpha}\right) \ge 1-\beta, \qquad \lambda = \frac{12N\sum_i w_i(\theta_i - \tfrac{1}{2})^{2}}{1 - \sum_j \bar{\pi}_j^{3}}

    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

    nrecruit=⌈n1−q⌉n_{\text{recruit}} = \left\lceil \frac{n}{1 - q} \right\rceil

    Applied last, to the participants actually recruited.

    Parameters

    Expected category probabilities in each groupπij\pi_{ij}

    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 sizeswiw_iOptional

    Values: One per group, each above 0; equal if omitted

    How many participants each group gets relative to the others.

    Significance levelα\alpha

    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.

    Power1−β1-\beta

    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 dropoutqqOptional

    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

    Protocol 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.

    Open this example in the calculator

    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 calculator

    An 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 calculator

    Validation

    • 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. 1.Lehmann EL. Nonparametrics: Statistical Methods Based on Ranks. San Francisco: Holden-Day; 1975.
    2. 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. 3.Noether GE. Sample size determination for some common nonparametric tests. Journal of the American Statistical Association. 1987;82(398):645–647.