All problems
Wilcoxon Signed Rank Sum
Problem
Rank the absolute differences ascending, assigning average ranks to ties, then sum the ranks of the positive differences.
Given the differences (none zero), return the positive signed-rank sum.
Hint
Tied magnitudes share the average of the positions they span.
Test cases
case 1
in: [[1,-2,3]]
expected: 4
case 2
in: [[1,1,-1]]
expected: 4
case 3
in: [[2,-1,-3,4]]
expected: 6
Starter codePython
def wilcoxon_signed_rank_sum(differences):
# Your code here
pass3 test cases · run your code against them in the editor