| Statistics Toolbox™ | ![]() |
p = ranksum(x,y)
[p,h] = ranksum(x,y)
[p,h] = ranksum(x,y,'alpha',alpha)
[p,h] = ranksum(...,'method',method)
[p,h,stats] = ranksum(...)
p = ranksum(x,y) performs a two-sided rank sum test of the null hypothesis that data in the vectors x and y are independent samples from identical continuous distributions with equal medians, against the alternative that they do not have equal medians. x and y can have different lengths. The p-value of the test is returned in p. The test is equivalent to a Mann-Whitney U-test.
[p,h] = ranksum(x,y) returns the result of the test in h. h = 1 indicates a rejection of the null hypothesis at the 5% significance level. h = 0 indicates a failure to reject the null hypothesis at the 5% significance level.
[p,h] = ranksum(x,y,'alpha',alpha) performs the test at the (100*alpha)% significance level. The default, when unspecified, is alpha = 0.05.
[p,h] = ranksum(...,'method',method) computes the p-value using either an exact algorithm, when method is 'exact', or a normal approximation, when method is 'approximate'. The default, when unspecified, is the exact method for small samples and the approximate method for large samples.
[p,h,stats] = ranksum(...) returns the structure stats with the following fields:
ranksum — Value of the rank sum test statistic
zval — Value of the z-statistic (computed only for large samples)
Test the hypothesis of equal medians for two independent unequal-sized samples. The sampling distributions are identical except for a shift of 0.25.
x = unifrnd(0,1,10,1); y = unifrnd(0.25,1.25,15,1); [p,h] = ranksum(x,y) p = 0.0375 h = 1
The test rejects the null hypothesis of equal medians at the default 5% significance level.
[1] Gibbons, J. D., Nonparametric Statistical Inference, 2nd edition, M. Dekker, 1985.
[2] Hollander, M., and D. A. Wolfe, Nonparametric Statistical Methods, Wiley, 1973.
kruskalwallis, signrank, signtest, ttest2
![]() | range | raylcdf | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |