Wilcoxon signed rank test - mauriceling/mauriceling.github.io GitHub Wiki

>>> 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]
>>> d = [X1[i]-X2[i] for i in range(len(X1))]
>>> result = stats.wilcoxon(d)
>>> print("W = %.2f" % result[0])
W = 15.00
>>> print("p-value = %.2f" % result[1])
p-value = 0.74

Reference:

  1. Wilcoxon F. 1945. Individual Comparisons by Ranking Methods. Biometrics Bulletin 1, 80-83.