Maxima Function
test_rank_sum (x1, x2)
test_rank_sum(x1,x2,option_1)
This is the Wilcoxon-Mann-Whitney test for comparing the medians of two continuous populations. The first two arguments x1 and x2 are lists or column matrices with the data of two independent samples. Performs normal approximation if any of the sample sizes is greater than 10, or if there are ties.
Option:
'alternative
, default 'twosided
, is the alternative hypothesis;
valid values are: 'twosided
, 'greater
and 'less
.
The output of function test_rank_sum
is an inference_result
Maxima object
with the following results:
'method
: inference procedure.
'hypotheses
: null and alternative hypotheses to be tested.
'statistic
: value of the sample statistic used for testing the null hypothesis.
'distribution
: distribution of the sample statistic, together with its parameters.
'p_value
: p-value of the test.
Examples:
Checks whether populations have similar medians. Samples sizes are small and an exact test is made.
(%i1) load("stats")$ (%i2) x:[12,15,17,38,42,10,23,35,28]$ (%i3) y:[21,18,25,14,52,65,40,43]$ (%i4) test_rank_sum(x,y); | RANK SUM TEST | | method = Exact test | | hypotheses = H0: med1 = med2 , H1: med1 # med2 (%o4) | | statistic = 22 | | distribution = [rank_sum, 9, 8] | | p_value = .1995886466474702
Now, with greater samples and ties, the procedure makes normal approximation. The alternative hypothesis is H_1: median1 < median2.
(%i1) load("stats")$ (%i2) x: [39,42,35,13,10,23,15,20,17,27]$ (%i3) y: [20,52,66,19,41,32,44,25,14,39,43,35,19,56,27,15]$ (%i4) test_rank_sum(x,y,'alternative='less); | RANK SUM TEST | | method = Asymptotic test. Ties | | hypotheses = H0: med1 = med2 , H1: med1 < med2 (%o4) | | statistic = 48.5 | | distribution = [normal, 79.5, 18.95419580097078] | | p_value = .05096985666598441