When you perform two-sample test with non-parametric tests such as K-S test and Mann–Whitney U test in MATLAB, is the p-value returned for a one-tailed test or for a two-tailed test?
Thanks.
Best Answer
Type "help kstest" and you may see (if your MATLAB is recent enough) that there's a 'Type' option to control whether it's one-tailed or two-tailed. But the default is two-tailed.
The function KSTEST by default, performs a two-tailed test. In case of such tests, if the significance level is alpha (0.05 by default), the null hypothesis is rejected if the P-value is less than alpha/2. To account for the tail in the computations, you have to specify the 4th input to the KSTEST function ('tail').
See the section under‘More About’ on theWilcoxon Rank Sum Test to find out how to calculate theU-statistic from the rank sum testW-statistic. The rank sum is available by asking for the third'stats' output from theranksum function.
Best Answer