MATLAB: Ranksum function – syntax, Statistics and Machine Learning toolbox

ranksumStatistics and Machine Learning Toolboxwilcoxon rank sum test

In one of the Matlab examples for the ranksum function it mentions that: “The weather data shows the daily high temperatures taken in the same month in two consecutive years. Perform a left-sided test to assess the increase in the median at the 1% significance level.” [p,h,stats] = ranksum(year1,year2,'alpha',0.01,'tail','left')”
I have tested and found that (as expected) the same result as before would be obtained as follows: [p,h,stats] = ranksum(year2,year1,'alpha',0.01,'tail','right')
Thus, is it correct that the syntax of the ranksum function is as follows: In the case where we perform a right tail test in order to test whether the population median of Year 2 is higher compared to Year 1 (with a selected significance level) do we put ‘year 2’ as the first input argument of the ranksum function and then ‘year 1’ as the second input argument and vice-versa?
Thank you very much, Iasonas

Best Answer

The precise language of the test (which I do think basically agrees with what you've just stated) can be found in the description of the "tail" input, in Name-Value pairs section of the documentation for ranksum.