scipy.stats.mannwhitneyu¶
- scipy.stats.mannwhitneyu(x, y, use_continuity=True, alternative=None)[source]¶
Computes the Mann-Whitney rank test on samples x and y.
Parameters: x, y : array_like
Array of samples, should be one-dimensional.
use_continuity : bool, optional
Whether a continuity correction (1/2.) should be taken into account. Default is True.
alternative : None (deprecated), ‘less’, ‘two-sided’, or ‘greater’
Whether to get the p-value for the one-sided hypothesis (‘less’ or ‘greater’) or for the two-sided hypothesis (‘two-sided’). Defaults to None, which results in a p-value half the size of the ‘two-sided’ p-value and a different U statistic. The default behavior is not the same as using ‘less’ or ‘greater’: it only exists for backward compatibility and is deprecated.
Returns: statistic : float
The Mann-Whitney U statistic, equal to min(U for x, U for y) if alternative is equal to None (deprecated; exists for backward compatibility), and U for y otherwise.
pvalue : float
p-value assuming an asymptotic normal distribution. One-sided or two-sided, depending on the choice of alternative.
Notes
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.
This test corrects for ties and by default uses a continuity correction. The reported p-value is for a one-sided hypothesis, to get the two-sided p-value multiply the returned p-value by 2.