BasicIndependently reviewed, not yet spot-checked by a human

Non-parametric tests: Wilcoxon and Kruskal-Wallis

The null hypothesis of the Wilcoxon rank-sum test is stochastic ordering, not equal medians — so "identical medians but a significant p-value" is not a contradiction. Also why a p-value alone is not enough, how to read the Hodges-Lehmann shift estimate, why a rank test and a log transform estimate different quantities, what ties do to the exact p-value, and which comparisons follow a Kruskal-Wallis test.

What this method is for

“The data do not look normal, so I switched to Wilcoxon” is how a rank test usually enters a paper, and it almost always arrives with an unstated misunderstanding attached: the belief that Wilcoxon compares medians.

It does not. The Wilcoxon rank-sum test (also known as the Mann-Whitney U test) is about stochastic ordering: draw one person at random from group A and one at random from group B, and ask whether the probability that the first exceeds the second is one half. As a formula, the null hypothesis is P(X>Y)=1/2P(X > Y) = 1/2. A median is one summary of a distribution; this probability depends on the whole distribution.

Most of the time the two agree, but they are not the same thing — and when they come apart, the results table carries a pair of numbers that look self-contradictory: two identical medians in Table 1 with a significant p-value underneath. Section two below builds exactly that situation.

This page uses two datasets: MASS::birthwt (189 mothers, outcome birth weight in grams) and datasets::sleep (Student’s own 1908 soporific data). The variable definitions are the same ones used on t-tests and analysis of variance, so numbers on the two pages can be read against each other.

The null hypothesis is stochastic ordering, not equal medians

The data below are constructed on purpose, to demonstrate something that really does happen. The setting is length of stay in days after the same operation at two hospitals:

  • Hospital A has no fixed discharge pathway, so each patient goes home when they are ready. That gives a long lower tail (plenty of patients leave the day after surgery) and a ceiling at 9 days.
  • Hospital B runs a pathway targeting discharge on day seven, so almost nobody leaves before day 6 and all the remaining variation runs upward — complications keep a few patients for three or four weeks.

Hospital A (30 patients): 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9

Hospital B (30 patients): 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 9, 10, 11, 12, 13, 14, 17, 18, 20, 22, 25

HospitalnMedian (days)Mean (days)Interquartile rangeRange
A3076.234.25 to 81 to 9
B30710.17 to 11.756 to 25

The difference between the medians is 0 days — exactly nothing. The Wilcoxon rank-sum test returns W = 629, p = 0.007.

Three panels. A is a mirrored count histogram of length of stay at the two hospitals, B above the line and A below it; both medians fall on day seven, but A has a long lower tail and B a long upper tail. B shows the two cumulative distribution functions, with hospital B's curve never rising above hospital A's and both crossing 0.5 at day seven. C is a grid of the 900 cross-group pairs, most cells showing hospital B as the longer stay.
A: mirrored counts, with the dashed line at the median the two groups share. B: cumulative distribution functions — hospital B's curve is never above hospital A's, which is the definition of stochastic ordering, and both cross 0.5 at the median, so the medians agree. C: all 900 cross-group pairs compared one at a time; hospital B is longer in 69.9% of them.Plotting script figures/scripts/B1-04-nonparametric.R

The middle panel carries the argument. Hospital B’s cumulative distribution function never rises above hospital A’s — wherever you set a threshold, the proportion of hospital B patients above it is never lower. That is the strict meaning of “hospital B tends to keep people longer”, and it is entirely compatible with equal medians: both step functions cross 0.5 on the step at day 7.

For completeness, the difference in means on the same data is 3.87 days, with a Welch t-test p < 0.001. What the mean can see, the median cannot — and the handful of patients in that right tail who stayed three weeks are precisely the ones the clinic needs to see.

Turning stochastic ordering into a number you can report

P(X>Y)P(X > Y) does not have to stay abstract; it can be estimated directly. Take every cross-group pair, score one when the first is larger and half each when they are equal, and divide by the number of pairs. Panel C above draws exactly that: 900 cells, one per pair of patients.

For the constructed example the estimate is 0.699: pick one patient from each hospital at random and the one from hospital B stays longer about 70% of the time.

Real data works the same way. For birth weight by maternal smoking in birthwt, the probability is 0.617 — pick one mother-infant pair from each group and the infant of the non-smoker is heavier about 62% of the time.

Its virtue is that you can say it out loud: “pick a patient on the new treatment at random and a patient on standard care at random, and the first recovers better seven times out of ten” carries far more information than a p-value, and it needs no distributional assumption at all.

A p-value is not enough: the Hodges-Lehmann shift estimate

By default the Wilcoxon output is a p-value and nothing else, so the results section becomes “median A vs B (p = …)”. That sentence stitches together two different things: the medians are summaries of each group, the p-value is a test of the comparison, and the effect size — how far apart, and how precisely — is missing from between them.

What fills that gap is the Hodges-Lehmann shift estimate: the median of all cross-group pairwise differences. wilcox.test(conf.int = TRUE) in R returns it with a confidence interval, in the units of the original data.

Three panels. A is a histogram of every cross-group pairwise difference in birth weight in the birthwt data, with a red vertical line at their median, which is the Hodges-Lehmann estimate. B places the Hodges-Lehmann shift estimate and the Welch mean difference with their 95% confidence intervals on one grams axis. C shows the ratio of geometric means from the log-transformed t-test with its confidence interval, on a ratio axis rather than a grams axis.
A: 8510 cross-group differences; the red line is their median, the Hodges-Lehmann estimate. B: the shift estimate and the mean difference are both in grams and can be read side by side. C: the log-transform route produces a ratio of geometric means, whose axis is a multiple and cannot be compared with panel B directly.Plotting script figures/scripts/B1-04-nonparametric.R

Taking smoking in birthwt as the example, one comparison yields three different numbers:

EstimateValue (grams)95% CIWhat it estimates
Difference between the two medians324.5not supplied by defaulttwo summaries subtracted; not the estimand of any test here
Hodges-Lehmann shift estimate306.285 to 512the median of the difference within a random cross-group pair
Welch mean difference283.878.6 to 489the difference between the two arithmetic means

All three land near three hundred grams, but they are not one quantity. The middle row is worth reading twice: Hodges-Lehmann estimates “the median of the differences”, not “the difference between the medians” — R’s own documentation labels the latter a common misconception. The two are close under symmetric distributions and are not close under skewed ones.

In practice, write it as “Hodges-Lehmann shift estimate 306.2 g (95% CI 85 to 512; Wilcoxon rank-sum p = 0.007)”, adding the estimate of P(X>Y)P(X > Y), 0.617, where it helps. As a check: computing the median of the 8510 pairwise differences directly gives 307 g, very close to the 306.2 g that wilcox.test() reports, though not the same number. The difference is one of algorithm: wilcox.test() inverts the test and solves with uniroot rather than taking the median of those 8510 differences.

Rank test or log transform? Two different estimands

A right-skewed variable — length of stay, cost, biomarker concentration — has a second route available: take logs and run a t-test. Both routes are defensible, but they do not produce the same quantity, and a paper has to say which one it took.

On the same birthwt data the two routes give:

Analysis routePoint estimate95% CIScale
Wilcoxon plus Hodges-Lehmann306.285 to 512grams (an additive shift)
t-test after log transformation1.1011.014 to 1.196a multiple (a ratio)

The second row says: the geometric mean birth weight among non-smokers (2950.8 g) is 1.101 times that among smokers (2679.8 g), which as a percentage is 10.1% higher (95% CI 1.4% to 19.6%), p = 0.022.

The difference is more than a change of units:

  • An additive shift assumes the groups differ by a fixed amount. Birth weight suits that reading, because the clinical threshold (low birth weight, 2500 g) is additive and “300 g lighter” means roughly the same thing for every infant.
  • A ratio assumes the groups differ by a fixed multiple. Quantities spanning orders of magnitude — viral load, C-reactive protein, hospital cost — suit that reading, because “10% higher” holds at both ends while “300 units higher” may be a tripling at the low end and negligible at the high end.
  • The log-scale t-test estimates a ratio of geometric means, not of arithmetic means. Back-transforming a mean of logs gives the geometric mean, which is always less than or equal to the arithmetic mean; a claim about arithmetic means needs separate handling.
  • Logs require every value to be positive. The usual log(x + 1) fix for zeroes lets that constant influence the answer, and the ratio loses its clean interpretation.

Ties and the exact p-value

The exact p-value of a rank test comes from every way of reallocating the N observations to the two groups. When the data contain ties, the tied observations can only be given the same average rank, which changes the permutation reference distribution.

Birth weight in birthwt is recorded to the gram and still has ties: 131 distinct values across 189 records, 97 of which share a value with somebody else, the largest group holding 5. Clinical data is essentially never tie-free.

Most textbooks say that ties make the exact p-value impossible and the software falls back on the normal approximation. That sentence is no longer true of current R (this page was verified on R 4.6.0): wilcox.test() carries the Streitberg-Röhmel shift algorithm, which under ties switches to the permutation distribution conditional on the observed ranks and still delivers exact inference.

What actually flips the default is sample size, not ties: exact when both samples hold fewer than 50 values, the normal approximation otherwise. So the constructed example on this page (30 per group) receives an exact p-value, while the smoking comparison in birthwt (115 against 74) receives the normal approximation.

Pulling out the rows whose birth weight is unique across the whole dataset (92 records, no ties at all) and then rounding that same subset to the nearest 250 g — the precision a chart review would realistically give you — shows what ties cost:

The same 92 recordsDistinct valuesLargest tied groupWExact pNormal-approximation p
recorded to the gram (no ties)92111800.25000.2487
rounded to 250 g171211600.31810.3174

Same patients, same comparison; measured more coarsely, and both the test statistic and the p-value move. Measurement precision is part of the analysis, not something that stops mattering once data collection ends.

A few practical points:

  • Report the software and its version. The same data under older R, SPSS or SAS may return a normal approximation rather than an exact p-value, and the two do not agree exactly.
  • The continuity correction only affects the approximation route. The smoking comparison gives p = 0.00677 with the correction and p = 0.00674 without; the gap is usually tiny, but not when a p-value sits against a threshold.
  • Do not jitter the data to break ties. That hands the answer to the random seed.
  • Past a certain density of ties the fix is a model, not a test: when the outcome is genuinely an ordered category (pain grade, NYHA class), ordinal logistic regression gives an effect size and covariate adjustment at the same time.

The paired version: Wilcoxon signed-rank

The same person measured before and after, the same person’s two eyes, a matched design — a one-to-one link means the paired version, for exactly the reason given for the paired t-test: pairing removes between-person variation entirely.

The Wilcoxon signed-rank test works on each person’s difference: rank the differences by absolute size, then ask whether the sum of the ranks attached to positive differences is off balance. On Student’s soporific data (10 subjects, each given both drugs), the differences are 1.2, 2.4, 1.3, 1.3, 0, 1, 1.8, 0.8, 4.6, 1.4.

Note that 1 of the subjects has a difference of exactly zero. That is common in paired data, and software handles it in more than one way:

AnalysisStatisticPoint estimate (hours)Confidence intervalp
signed-rank (what R 4.6.0 does)V = 541.30.9 to 2.7 (achieved level 95.6%)0.0039
signed-rank (the textbook recipe: drop the zero)V = 451.41.1 to 2.95 (achieved level 96.5%)0.0039
paired t-testt = 4.061.580.7 to 2.460.0028

The two treatments of the zero difference give the same p-value here, but the point estimate and the interval both differ, and nothing in the output tells you a choice has just been made. When there are zero differences, put the software and its version in the methods.

One more detail that is easy to miss: the achieved coverage of the two rank-based intervals above is 95.6% and 96.5%, not exactly 95%. Rank statistics are discrete, only a finite set of levels is attainable, and R picks the closest and says so.

Three groups or more: Kruskal-Wallis and its post hoc comparisons

The Kruskal-Wallis test is the rank version of ANOVA: rank every observation together, then ask whether the groups have the same mean rank. It is likewise an omnibus test — significance means “not all alike”, not which pair differs.

Splitting birthwt by maternal race gives three groups:

GroupnMedian (g)Interquartile rangeMean rank
White9630622584.75 to 3651106.1
Black2628492370.5 to 305777.5
Other6728352313 to 327485.8

The omnibus result is χ2\chi^2 = 8.52 on 2 df, p = 0.014.

There is a common way of running the pairwise comparisons that is wrong: three separate Wilcoxon rank-sum tests. The problem is that each of them re-ranks only the two groups involved, discarding what the third group tells you, and the three reference distributions are mutually inconsistent. The correct approach (Dunn’s test) ranks once, compares the group mean ranks using a variance computed from the whole sample, and shares one tie correction across all comparisons.

Two panels. A plots the birth weight ranks of the three racial groups as jittered points with a horizontal bar at each group's mean rank; the White group's mean rank is clearly above the other two. B plots the three pairwise comparisons on a logarithmic p-value axis, with open circles for unadjusted p-values, filled circles for Holm-adjusted ones and a dashed line at 0.05; both comparisons that started left of the line end up to its right.
A: what the test actually sees is ranks, not grams; the thick bar is each group's mean rank. B: Dunn pairwise comparisons, open circles unadjusted and filled circles Holm-adjusted, dashed line at 0.05. Both comparisons that were below 0.05 cross the threshold once adjusted.Plotting script figures/scripts/B1-04-nonparametric.R
ComparisonMean ranksDunn zUnadjusted pHolm-adjusted p
White vs Black106.1 vs 77.52.370.01790.0537
White vs Other106.1 vs 85.82.330.01970.0537
Black vs Other77.5 vs 85.8-0.660.50960.5096

This table is the point of the section. The omnibus test (p = 0.014) is significant, yet after the Holm adjustment none of the three pairwise comparisons reaches statistical significance. That is not a contradiction, and it does not mean the groups are alike — it means the evidence in this dataset is not strong enough to name which pair differs while holding the family-wise error rate. The sentence to write is “did not reach statistical significance”, not “there was no difference”.

A few practical points:

  • Fix the post hoc method and the adjustment in the protocol. “All pairs” and “each group against the control” need different adjustments, and the arithmetic of accumulating type I error is on t-tests and analysis of variance.
  • Holm is almost always preferable to Bonferroni. Both control the family-wise error rate; Holm is the stepwise version, strictly more powerful under the same assumptions.
  • Kruskal-Wallis does not compare medians either. Reading it as a shift requires the extra assumption that the group distributions have a similar shape, exactly as in the two-group case.
  • Once covariates need adjusting, a rank test is not enough. Rank tests have no adjustment mechanism; move to ordinal logistic regression or to linear regression on a transformed variable.

Run it yourself

library(MASS)
data(birthwt, package = "MASS")

birthwt$smoke_f <- factor(birthwt$smoke, levels = c(0, 1),
                          labels = c("Non-smoker", "Smoker"))
birthwt$race_f  <- factor(birthwt$race, levels = 1:3,
                          labels = c("White", "Black", "Other"))

# Two independent samples: conf.int = TRUE is what yields Hodges-Lehmann
wilcox.test(bwt ~ smoke_f, data = birthwt, conf.int = TRUE)

# P(X > Y): count the pairs directly, ties scoring half
ns <- birthwt$bwt[birthwt$smoke_f == "Non-smoker"]
sm <- birthwt$bwt[birthwt$smoke_f == "Smoker"]
mean(outer(ns, sm, ">")) + 0.5 * mean(outer(ns, sm, "=="))

# The other route: a t-test on logs, giving a ratio of geometric means
fit <- t.test(log(ns), log(sm))
unname(exp(c(diff(rev(fit$estimate)), fit$conf.int)))

# Paired. ⚠️ Since R 4.6 the formula interface rejects paired = TRUE outright,
# so pass two vectors or use the Pair() form.
data(sleep)
d1 <- sleep$extra[sleep$group == 1]
d2 <- sleep$extra[sleep$group == 2]
wilcox.test(d2, d1, paired = TRUE, conf.int = TRUE)
wilcox.test(Pair(d2, d1) ~ 1, conf.int = TRUE)   # equivalent

# Three groups or more
kruskal.test(bwt ~ race_f, data = birthwt)

# Dunn post hoc: rank once, use the whole-sample variance, then adjust with Holm
r <- rank(birthwt$bwt); N <- length(r); tie <- table(birthwt$bwt)
s2 <- N * (N + 1) / 12 - sum(tie^3 - tie) / (12 * (N - 1))
nn <- tapply(r, birthwt$race_f, length); rb <- tapply(r, birthwt$race_f, mean)
cb <- combn(levels(birthwt$race_f), 2)
z  <- apply(cb, 2, function(k) (rb[[k[1]]] - rb[[k[2]]]) /
                               sqrt(s2 * (1 / nn[[k[1]]] + 1 / nn[[k[2]]])))
data.frame(pair = apply(cb, 2, paste, collapse = " vs "),
           z = round(z, 2),
           p_holm = p.adjust(2 * pnorm(-abs(z)), method = "holm"))

Verified on R 4.6.0 with MASS 7.3.65. conf.int = TRUE is not the default, and without it there is nothing to report but a p-value.

Common misuses

MisuseWhy it is wrong
Saying “Wilcoxon compares medians”It tests P(X>Y)=1/2P(X > Y) = 1/2; identical medians with a significant test are possible
Reporting only a p-value, with “median A vs B” as the effect sizeThe difference between medians is not this test’s estimand; report the Hodges-Lehmann shift estimate and its interval
Reading Hodges-Lehmann as “the difference between the medians”It is “the median of the differences”, and on skewed data the two differ
Running a normality test to decide whether to go non-parametricThe power runs opposite to the need; see the t-test page
Reaching for a rank test whenever data are skewed, without considering logsThe two routes estimate a shift and a ratio; clinical interpretation decides, not the p-value
Putting the Hodges-Lehmann grams and the geometric mean ratio in one columnDifferent scales, one additive and one multiplicative; they cannot be compared directly
Three unadjusted Wilcoxon tests for three groupsEach re-ranks and discards the third group, and the family-wise error rate is uncontrolled
Claiming “all groups differ” from a significant omnibus testKruskal-Wallis says “not all alike”; in this page’s example no pairwise comparison survives adjustment
Jittering the data to remove tiesThe conclusion then depends on the random seed
Not stating how zero differences in paired data were handledKeeping and dropping them give different point estimates and intervals, and the output does not warn you
Writing “there was no difference” when p > 0.05Only that this study did not detect one; claiming equivalence needs an equivalence design and a pre-specified margin
Sticking with a rank test when covariates need adjustingRank tests have no adjustment mechanism; move to a regression model

Regenerating every number on this page

/opt/homebrew/bin/Rscript figures/scripts/B1-04-nonparametric.R

Read the figure

The answer comes from the same statistical output that produced this page's figures, not from a number typed in beside them.

Two hospitals have exactly the same median length of stay, a median difference of 0, and yet the Wilcoxon rank-sum test is significant. Has something been computed wrongly?

Show the answer and why

Correct answer: Nothing is wrong. The test asks about stochastic ordering: pick one patient from each hospital at random and the chance that the second stays longer is 0.70, which is entirely compatible with equal medians

The null hypothesis of the Wilcoxon test is stochastic ordering, not equality of medians. The cumulative distribution of the second hospital never rises above that of the first - whatever threshold you pick in days, the proportion staying longer than it is never lower at the second hospital - while both step functions cross the halfway line on the same step. So the second hospital being systematically longer sits perfectly comfortably with identical medians, and 0.70 is what turns that into a reportable number. The median difference of 0.00 is real; it simply answers a different question. The mean difference of 3.87 is real too, and it sees what the median cannot: the handful of patients in the right tail who stay three or four weeks, who are exactly the patients that matter clinically. Treating the disagreement between two summaries as an error is the misreading; the disagreement is the information. The mirror case holds as well - very different medians with a non-significant Wilcoxon test is no contradiction either.

On the same birth weight data, Wilcoxon with Hodges-Lehmann gives a point estimate of 306.2 grams, while a t-test on the log scale gives a multiple. Can one stand in for the other?

Show the answer and why

Correct answer: No. 1.1 is a ratio of geometric means, measured in multiples, while the shift estimate is measured in grams

An additive shift assumes the groups differ by a fixed amount; a multiplicative ratio assumes they differ by a fixed factor. The clinical threshold for birth weight is additive - three hundred grams less means much the same for every baby - so the shift estimate makes sense. Quantities spanning orders of magnitude behave the other way: viral load, C-reactive protein and hospital costs are naturally multiplicative, since ten per cent higher holds at the low end and the high end alike, while three hundred units higher might be a tripling at the low end and negligible at the high end. 324.5 is the difference in medians, and it lands near 306.2 not through rounding but because both live on the same additive scale, though they are defined differently: the shift estimate is the median of all between-group pairwise differences. 10.1 comes from the ratio of geometric means, and a geometric mean is always at most the arithmetic mean, so multiplying it back onto an arithmetic mean produces a quantity nobody has defined; claiming anything about arithmetic means needs separate work. Logs also require every value to be positive, and the familiar trick of adding a constant lets that constant drive the result and costs the ratio its clean interpretation.

The same 92 mothers - 53 non-smokers and 39 smokers - with birth weight recorded to the gram give an exact p of 0.2500. Round the same data to the nearest 250 grams and the exact p becomes 0.3181. Why does it move?

Show the answer and why

Correct answer: Rounding pushes 12 observations onto one value, and tied observations can only receive the same mean rank

An exact p value for a rank test comes from every way of reassigning the observations to the two groups. When values tie, those observations can only take the same mean rank, the reference distribution changes accordingly, and the same patients in the same comparison give a different statistic and a different p value purely because they were measured more coarsely - after rounding, the largest group of tied values holds 12 observations. The 17 distinct values are another way of saying the same thing, but the sample size has not shrunk: there are still 92 people, and what changed is how finely they can be told apart. 50 really is where R switches between the exact method and the normal approximation, but the switch looks at how many observations sit in each group, and 53 is already past that line: on R's defaults this subset takes the normal approximation, and the exact p values quoted here come from the script passing exact = TRUE explicitly, with both methods printed side by side in the same table. So what that option gets wrong is not the threshold but the inference that rounding carries the data across it - rounding changes only how many distinct values there are, and the group sizes of 53 and 39 are the same before and after. Never add random jitter to break ties, which hands the answer to the random seed; and when ties get bad enough, what needs changing is the model rather than the test.

One of the ten subjects in the sleep data has a difference of exactly zero. The current R signed-rank statistic is 54, the textbook approach that drops zero differences gives 45, and both give the same p value. Does that make the two interchangeable?

Show the answer and why

Correct answer: No. Dropping the zero moves the point estimate to 1.40, different from the current approach, with a different interval, and nothing in the output warns you that a choice has just been made

Identical p values do not make identical conclusions. Dropping the zero moves the point estimate to 1.40, away from the current approach, and moves the interval too, while nothing in the output flags that a choice was made - which is why software and version belong in the Methods whenever zero differences are present. 1.58 is the paired t-test mean difference, a quantity from a different route: what signed-rank reports is a pseudomedian, equal to the median of the differences only when those differences are symmetric, so a clearly skewed set of differences costs this test its standing as the assumption-free safe option. The 95.60 is worth a second look as well. The actual coverage of a non-parametric interval is not exactly ninety-five per cent, because rank statistics are discrete and only finitely many levels are attainable, and the two ways of handling zeros do not attain the same one.

Birth weight across three groups gives a Kruskal-Wallis p of 0.0141. In the Dunn comparisons, White versus Black has an unadjusted p of 0.0179 and a Holm-adjusted p of 0.0537. How should the paragraph be written?

Show the answer and why

Correct answer: Report the adjusted 0.0537, and say that a significant omnibus test means only that the groups are not all alike

Kruskal-Wallis is an omnibus test: significance says only that the mean ranks are not all equal, never which group differs from which, so 0.0141 has to be followed by pairwise comparisons and those comparisons have to be adjusted. Treating a significant omnibus test as a licence to skip adjustment is Fisher’s LSD, which stops protecting the family-wise error rate beyond three groups. After adjustment 0.0179 becomes 0.0537, on the other side of the conventional level, and that is exactly the place to be honest: report both numbers so the reader can see that the comparison looked significant unadjusted and does not survive adjustment. 0.5096 is the adjusted p of a different comparison and does not represent the error rate of the set, since Holm adjusts each comparison separately rather than taking the largest. And a non-significant result can only be written as this study did not detect a difference, never as the groups being alike.

A paper reports the chance that, picking one mother-baby pair at random from each of the non-smoking and smoking groups, the non-smoking baby is the heavier one. The same paragraph also carries a Wilcoxon p value and a Hodges-Lehmann shift estimate. What does that probability answer?

Show the answer and why

Correct answer: 0.617 answers how badly the two groups overlap - it is the area under the ROC curve when group is the gold standard and the outcome the predictor

0.617 estimates stochastic ordering: count every between-group pair, score one when the first is larger and a half when they tie, and divide by the number of pairs. It equals the area under the ROC curve with group as the gold standard and the outcome as the predictor, the c-statistic, and dividing the Wilcoxon statistic by the product of the two group sizes gives it directly. 0.007 is the p value of the same test, answering whether an overlap like this looks like sampling luck rather than how bad the overlap is - with a large enough sample a probability very close to a half still produces a tiny p value. 0.699 comes from the deliberately constructed teaching data on this page, which the script marks as hypothetical rather than the result of any study, so subtracting it from a real estimate produces a number about nothing. The real strength of this quantity is that it can be said out loud to a patient, which carries far more information than a p value does.

Watch next

醫學統計 EP10 t 檢定與非參數法
繁中EDMAN MURMURS· 10 minTraditional Chinese, written for clinicians. It puts the t-test and its rank-based alternatives side by side, which makes a good warm-up for this page.
醫學統計 EP11 ANOVA
繁中EDMAN MURMURS· 14 minThe Kruskal-Wallis test in the last section is the rank version of ANOVA; understanding what ANOVA compares first saves a lot of effort.

Sources and licences

This page is original writing

Report a content problem

The statistics on this site are written by AI and reviewed by AI; a human only spot-checks. What you can see may be what we cannot.

The more specific, the more fixable — e.g. which sentence disagrees with which textbook or paper.

Needed only if you want a reply; reports without it are still read.

Sent along with your report

These are attached automatically. You can drop any of them.