Skip to content

Instantly share code, notes, and snippets.

@lylayang
Created October 2, 2019 09:16
Show Gist options
  • Save lylayang/271a1a2906cbe85db1a9ff9ef2efdeb7 to your computer and use it in GitHub Desktop.
Save lylayang/271a1a2906cbe85db1a9ff9ef2efdeb7 to your computer and use it in GitHub Desktop.
import numpy as np
from scipy.stats import mannwhitneyu
sample1=[32, 34, 29, 39, 38, 37, 38, 36, 30, 26]
sample2=[40, 34, 30, 39, 38, 37, 38, 36, 50, 49]
stat, pvalue=mannwhitneyu(sample1, sample2)
print('statistics=%.3f, p=%.5f'%(stat,pvalue))
alpha=0.05
if pvalue> alpha:
print('Two Groups are from the Same distribution(fail to reject H0) under alpha=0.05')
else:
print('Two Groups are from Different distributions(reject H0) under alpha=0.05')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment