In the ‘Increase in the Median’ example for the ranksum function (please see: https://uk.mathworks.com/help/stats/ranksum.html) 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')”
The output of the function gives: h=0 i.e. the Null hypothesis cannot be rejected.
My question is the following: I have calculated that the Median value of temperatures for Year 1 [median(year1)] is: 60.5 and the Median value of temperatures for Year 2 [median(year2)] is: 62. Consequently, if in the previous function we exchange year2 with year1 i.e.: [p,h,stats] = ranksum(year2,year1,'alpha',0.01,'tail','left') then we should always get h=0, irrespective of the value of ‘alpha’, given that the Median value of temperatures for Year 1 is lower compared to the Median value of temperatures for Year 2. However, if we select any value of ‘alpha’ greater than 0.87 (e.g. 0.88) we get h=1 instead of h=0. I know that this value of ‘alpha’ is ridiculously high however, the value of h should be equal to 0 for any value of ‘alpha’ between 0 and 1 given that the Median value of temperatures for Year 1 is less than the Median value of temperatures for Year 2.
Is there an explanation for this strange result which occurs for values of alpha which are greater than 0.87?
Thank you very much,
Iasonas
Best Answer