U-testing in statistics.

The Mann-Whitney U-test (usually called U-test) is used to compare differences between two independent data groups which are not normally distributed. The Mann-Whitney U test is often considered the nonparametric alternative to the independent t-test. Scale of data measurements should be ordinal, interval or ratio.

Mann-Whitney U-test with Python.

The null hypothesis of the U-test is that the distribution underlying sample x is the same as the distribution underlying sample y.
Mann-Whitney U test is used for every field, but is frequently used in psychology, healthcare, nursing, business, and many other disciplines.

Generating initial data for Mann-Whitney u-test:

import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as stats

# the data (different sample sizes)
N1 = 30
N2 = 35

data1 = np.random.poisson(2,N1)
data2 = np.random.poisson(1,N2)


plt.xlabel('Data group')
plt.ylabel('Data value')

Generating initial data for Mann-Whitney u-test

Mann-Whitney u-test using the Python scipy library:

U,p = stats.mannwhitneyu(data1,data2)


OUT: 320.0 0.0027477016627586097

See also related topics: