# Mann-Whitney U test for sample sizes 65 and 10 in Python

I would like to run the Mann-Whitney U for two groups with sizes 65 and 10, where I essentially want to compare scores on some measure between two different groups.

I have two questions regarding the mannwhitneyu function in python's scipy stats library:

• First of all, the documentation says:

Use only when the number of observation in each sample is > 20 and you have 2 independent samples of ranks. Mann-Whitney U is significant if the u-obtained is LESS THAN or equal to the critical value of U.

So I assume I can't use it since the size of my second sample is < 20. The only alternative I know is where both sample sizes < 20, where we manually calculate $U$, and then compare the test statistic against a table of critical values. However, the only tables I can find are where both sample sizes are < 20.

So is there a version of Mann-Whitney U I can use for these sample sizes (preferably with implementation in python)? Or should I use an entirely different test, such as Mood's Median test?

My second question is a bit more general regarding the mannwhitneyu in scipy:

• It seems to output the test statistic $U$ and a $p-$value. So if you had sample sizes greater than 20, and you wanted to determine whether this result is statistically significant, is the $p-value$ that is outputted, the one for normalised $U$? I.e. it is the $p-$value for $z = \frac{U-m_u}{\sigma_u}$ ? So can you just read off this $p-$value to determine the statistical significance of the difference between the two groups? If so, what is the point of the function outputting $U$? What would you do with that information?

The reason for this restriction is in order to use the normal approximation rather than producing exact p-values. Actually even with sample sizes of 10 and 65 the normal approximation isn't so bad out to about 2.5 sd's from the mean (out to 2-tailed p-values of about 0.01), but further out than that it starts to get pretty poor.

There's no reason why exact values can't be computed (R will calculate the entire distribution of the test statistic under the null at these sample sizes quite happily, for example).

• Thanks for your answer. Just to clarify, I'm just wondering if you know whether the $p$ value that is given in the output from scipy is the $p$ value associated with the normal distribution already? In other words, if I have observed that the mean of one group is greater than the other, can I just read off the $p$ value to determine it's statistical significance? Commented Dec 15, 2016 at 22:14
• I'm sorry, I'm not quite sure what you're asking. The actual distribution of the Mann-Whitney test statistic is discrete, not normal. The thing labelled p-value in the output will be an approximation to the correct p-value for the Mann-Whitney, using a normal approximation to the exact distribution. I was pointing out that as long as you don't go deep into the tail, the p-value obtained by using the normal approximation isn't so bad for sample sizes of 10 and 65. If mannwhitneyu won't do it, it's easy to compute the Z score directly and just call a normal-cdf function to obtain a p-value. Commented Dec 15, 2016 at 22:29
• Thanks, that answers my question. Apologies, the way I phrased my above comment wasn't very clear. I think I will use a different non-parametric test, the mannwhitneyu test in scipy seems quite poorly documented. Commented Dec 15, 2016 at 22:54