# scipy.stats.brunnermunzel

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

  Compute 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.

  Parameters:
    x, y array_like

      Array of samples, should be one-dimensional.

    alternative{‘two-sided’, ‘less’, ‘greater’}, optional

      Defines the alternative hypothesis. The following options are available (default is ‘two-sided’):

      > - ‘two-sided’

      > - ‘less’: one-sided

      > - ‘greater’: one-sided

    distribution{‘t’, ‘normal’}, optional

      Defines how to get the p-value. The following options are available (default is ‘t’):

      > - ‘t’: get the p-value by t-distribution

      > - ‘normal’: get the p-value by standard normal distribution.

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

      Defines how to handle when input contains nan. The following options are available (default is ‘propagate’):

      > - ‘propagate’: returns nan

      > - ‘raise’: throws an error

      > - ‘omit’: performs the calculations ignoring nan values

  Returns:
    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

  `mannwhitneyu`

    Mann-Whitney rank test on two samples.

  Notes

  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]).

  References

  [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]

  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.

  Examples

      >>> 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
      3.1374674823029505
      >>> p_value
      0.0057862086661515377