Choosing between the MannWhitney and KolmogorovSmirnov tests 

Choosing between the MannWhitney and KolmogorovSmirnov tests 


Both the MannWhitney and the KolmogorovSmirnov tests are nonparametric tests to compare two unpaired groups of data. Both compute P values that test the null hypothesis that the two groups have the same distribution. But they work very differently:
•The MannWhitney test first ranks all the values from low to high, and then computes a P value that depends on the discrepancy between the mean ranks of the two groups.
•The KolmogorovSmirnov test compares the cumulative distribution of the two data sets, and computes a P value that depends on the largest discrepancy between distributions.
Here are some guidelines for choosing between the two tests:
•The KS test is sensitive to any differences in the two distributions. Substantial differences in shape, spread or median will result in a small P value. In contrast, the MW test is mostly sensitive to changes in the median.
•The MW test is used more often and is recognized by more people, so choose it if you have no idea which to choose.
•The MW test has been extended to handle tied values. The KS test does not handle ties so well. If your data are categorical, so has many ties, don't choose the KS test.
•Some fields of science tend to prefer the KS test over the MW test. It makes sense to follow the traditions of your field.