ranksum
statistics: p = ranksum (x, y)
statistics: p = ranksum (x, y, alpha)
statistics: p = ranksum (x, y, alpha, Name, Value)
statistics: p = ranksum (x, y, Name, Value)
statistics: [p, h] = ranksum (x, y, …)
statistics: [p, h, stats] = ranksum (x, y, …)
Wilcoxon rank sum test for equal medians. This test is equivalent to a Mann-Whitney U-test.
p = ranksum (x, y) returns the p-value of a
two-sided Wilcoxon rank sum test. It tests the null hypothesis that two
independent samples, in the vectors X and Y, come from continuous
distributions with equal medians, against the alternative hypothesis that
they are not. x and y can have different lengths and the test
assumes that they are independent.
ranksum treats NaN in x, y as missing values.
The two-sided p-value is computed by doubling the most significant one-sided
value.
[p, h] = ranksum (x, y) also returns the
result of the hypothesis test with h = 1 indicating a rejection
of the null hypothesis at the default alpha = 0.05 significance level, and
h = 0 indicating a failure to reject the null hypothesis at the
same significance level.
[p, h, stats] = ranksum (x, y) also
returns the structure stats with information about the test statistic.
It contains the field ranksum with the value of the rank sum test
statistic, and the field zval with the value of the z-statistic when
computed with the "approximate" method, and empty otherwise. The field is
always there. Two further fields, an Octave extension, hold the effect
size: RankBiserial, the rank-biserial correlation, which is Cliff’s
delta, the share of pairs (x_i, y_j) with x_i > y_j less the
share with x_i < y_j, and RankBiserialCI, its two-sided
confidence interval at the level 100 (1 - alpha) percent, whatever
the tail. Both are those of meanEffectSize (x, y,
"Effect", "cliff"): by default the interval is Cliff’s, and the options
"ConfidenceIntervalType", "bootstrap" for a BCa bootstrap
interval, "NumBootstraps" and "Resampling" are passed on to
meanEffectSize.
[…] = ranksum (x, y, alpha) or alternatively
[…] = ranksum (x, y, "alpha", alpha) returns
the result of the hypothesis test performed at the significance level ALPHA.
[…] = ranksum (x, y, "method", M) defines the
computation method of the p-value specified in M, which can be "exact",
"approximate", or "oldexact". M must be a single string. When "method"
is unspecified, the default is: "exact" when
min (length (x), length (y)) < 10 and
length (x) + length (y) < 20, otherwise the "approximate"
method is used.
[…] = ranksum (x, y, "tail", tail) defines the
type of test, which can be "both", "right", or "left". tail must be a
single string.
Note: the rank sum statistic is based on the smaller sample of vectors x and y.
See also: signrank, kruskalwallis, meanEffectSize
Source Code: ranksum