The ranks sum test (Wilcoxon rank-sum test or Mann–Whitney U test) is a non-parametric test to determine if two independent samples and are have the same distribution. It can be regarded as the non-parametric equivalent of the 2-sample t-test.
The null hypothesis and alternative hypothesis can be written as: : the distributions of and are equal. : the distributions of and are not equal.
The Mann–Whitney U statistic is calculated for each sample as follows: where is the sum of ranks of sample set and is the sample size of sample set . The final U statistic is:
The procedure takes into consideration tied ranks.
Impure wrapper procedure for s_tst_ranksum_core
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in) | :: | x1(:) |
x1 vector (samples) |
||
real(kind=wp), | intent(in) | :: | x2(:) |
x2 vector (samples) |
||
real(kind=wp), | intent(out) | :: | u |
U statistic |
||
real(kind=wp), | intent(out) | :: | p |
p-value |
||
character(len=*), | intent(in), | optional | :: | h1 |
option: "two" (default), "lt", or "gt" |