Diogo Santos
Diogo Santos

Reputation: 884

Error in scipy Wilcoxon signed-rank test

I was digging in the scipy code for this test Wilcoxon signed-rank test (stats.wilcoxon) and I found that in scipy they compute the sum of the ranks for the differences that are positives and separately for the ones that are negatives. Then they picked the smaller one and use that as W. That is substantially different from the test explanation in Wikipedia, or other sites(http://vassarstats.net/textbook/ch12a.html) where W = sum(all the differences).

Is this approach valid?

Upvotes: 2

Views: 547

Answers (1)

Robert Dodier
Robert Dodier

Reputation: 17577

For many statistical functions, there are alternate definitions which have different properties. Sometimes one is more useful, sometimes another. To find out why the author or authors of scipy chose the definition you found, you'll have to ask them. My advice is to look at the revision history (Git or whatever, I don't know what Scipy uses) of scipy.Wilcoxon or ask on the Scipy developers mailing list. Hope this helps.

Upvotes: 1

Related Questions