-
Notifications
You must be signed in to change notification settings - Fork 10
Wilcoxon rank sum test
Maurice HT Ling edited this page Aug 13, 2021
·
3 revisions
Purpose: To test whether 2 samples are drawn from the same population by calculating rank-sum.
Null hypothesis: Sample A and Sample B were drawn from the same population
Alternate hypothesis: Sample A and Sample B were not drawn from the same population
Note: Mann-Whitney U test is effectively the same as Mann-Whitney U test, and is a non-parametric version of 2-samples (independent samples) t-test.
Code:
>>> from scipy import stats
>>> X1 = [9.07, 8.97, 6.41, 3.03, 1.19, 2.67, 2.81, 9.2]
>>> X2 = [3.82, 8.26, 5.99, 3.81, 1.07, 5.06, 5.66, 4.47]
>>> result = stats.ranksums(X1, X2)
>>> print("statistic = %.2f" % result[0])
statistic = 0.32
>>> print("p-value = %.2f" % result[1])
p-value = 0.75
Copyright (c) 2008-2024, Maurice HT Ling
Refereed Publications and Technical Reports
Abstracts and Other Un-Refereed Works
Autobiographic Verses (Poems that I wrote) and My Sayings