Thank you for your quick response.
Your roc function is indeed very good.
For those who would just want a quick measure of effect size, it's easy to perform the empirical AUC from Giuseppe Cardillo's function by adding:
STATS.auc = U / (L(1)*L(2));
More information see:
The results are exactly equal: ranksum gives a 2-tailed p-value and mwwtest gives a 1-tailed p-value. If you need a 2-tailed p-value simply multiply 1-tailed p-value by 2 (or, viceversa, divide 2-tailed p-value by 2 if you need 1-tailed p-value).
For Area Under The Curve, please, look at roc.m function that I wrote.
Thank you very much for this useful function.
Is it normal that the p-values it makes are different from those obtained with matlab's ranksum function:
[p h stats] = ranksum(1:100,11:110)
stats = mwwtest(1:100,11:110)
If so, which one shall we report?
As an addup, I think it would be great to add an output of the effect size using the area under the curve, as well as the confidence interval.
1) if you have to compare more than 2 groups mwwtest is not the test for you...you should use the Kruskal-Wallis test. Or if you have "repeated measures" of the same group in different moments you should use the Friedman's test.
2) the concept of the mwwtest is that if the medians are equals the ranks will distribute equally in both groups and they will have a mean equal to n1*n2/2 (and so you can use Z-score...). The acceptance is the same of the Student's t-test because T (or U) is asintotically normally distributed. The magnitude of T is not the only parameter....if you two very large samples sizes also mean(T) will be very large...
Thanks Giuseppe for your reply. Didn't know there were different computational methods.
About testing medians; of course I know how to use the median command ;). My research is into finance and I test whether activity of specific type of traders is larger in one period compared the other. I use the Mann-Whitney test in addition to a one-tailed independent sample T-test, because some samples violate the normal distribution severely.
Now I corrected all significant test results, which were in the wrong tail (according to the calculated medians) and thus the null hypothesis holds. In contrast, the T-test is symmetric and concludes on the direction of the result.
What then is the acceptance area of the null hypothesis w.r.t. the MWWtest? I guess it is around n1*n2/2? What if the U-statistic is much larger?