Great function. Thank you!
I changed the first line from
function[Levenetest] = Levenetest(X,alpha)
function[F, df1, df2, P] = Levenetest(X,alpha)
and suppressed all displays and prints (lines 87, 107:114, 144:153)
such that I can run multiple levene tests and save the results of each.
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...