scipy.stats.mstats.brunnermunzel(x, y, alternative='two-sided', distribution='t')[source]#

Compute the Brunner-Munzel test on samples x and y.

Any missing values in x and/or y are discarded.

The Brunner-Munzel test is a nonparametric test of the null hypothesis that when values are taken one by one from each group, the probabilities of getting large values in both groups are equal. Unlike the Wilcoxon-Mann-Whitney’s U test, this does not require the assumption of equivariance of two groups. Note that this does not assume the distributions are same. This test works on two independent samples, which may have different sizes.

x, yarray_like

Array of samples, should be one-dimensional.

alternative‘less’, ‘two-sided’, or ‘greater’, optional

Whether to get the p-value for the one-sided hypothesis (‘less’ or ‘greater’) or for the two-sided hypothesis (‘two-sided’). Defaults value is ‘two-sided’ .

distribution‘t’ or ‘normal’, optional

Whether to get the p-value by t-distribution or by standard normal distribution. Defaults value is ‘t’ .


The Brunner-Munzer W statistic.


p-value assuming an t distribution. One-sided or two-sided, depending on the choice of alternative and distribution.

See also


Mann-Whitney rank test on two samples.


For more details on brunnermunzel, see scipy.stats.brunnermunzel.


>>> from scipy.stats.mstats import brunnermunzel
>>> import numpy as np
>>> x1 = [1, 2, np.nan, np.nan, 1, 1, 1, 1, 1, 1, 2, 4, 1, 1]
>>> x2 = [3, 3, 4, 3, 1, 2, 3, 1, 1, 5, 4]
>>> brunnermunzel(x1, x2)
BrunnerMunzelResult(statistic=1.4723186918922935, pvalue=0.15479415300426624)  # may vary