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

Computes the Brunner-Munzel test on samples x and y

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, y : array_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’ .

nan_policy : {‘propagate’, ‘raise’, ‘omit’}, optional

Defines how to handle when input contains nan. ‘propagate’ returns nan, ‘raise’ throws an error, ‘omit’ performs the calculations ignoring nan values. Default is ‘propagate’.

statistic : float

The Brunner-Munzer W statistic.

pvalue : float

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.


Brunner and Munzel recommended to estimate the p-value by t-distribution when the size of data is 50 or less. If the size is lower than 10, it would be better to use permuted Brunner Munzel test (see [2]).


[1]Brunner, E. and Munzel, U. “The nonparametric Benhrens-Fisher problem: Asymptotic theory and a small-sample approximation”. Biometrical Journal. Vol. 42(2000): 17-25.
[2](1, 2) Neubert, K. and Brunner, E. “A studentized permutation test for the non-parametric Behrens-Fisher problem”. Computational Statistics and Data Analysis. Vol. 51(2007): 5192-5204.


>>> from scipy import stats
>>> x1 = [1,2,1,1,1,1,1,1,1,1,2,4,1,1]
>>> x2 = [3,3,4,3,1,2,3,1,1,5,4]
>>> w, p_value = stats.brunnermunzel(x1, x2)
>>> w
>>> p_value

Previous topic


Next topic