Skip to content
DeepForgeby svx
All problems
MediumStatisticsst-177

Cliff's Delta

Problem

Return Cliff's delta, the difference in the proportions of favorable pairwise comparisons: (#(x > y) - #(x < y))/(n1*n2). Return 0.0 if either sample is empty.

Hint

It is the nonparametric effect size between -1 and 1.

Test cases

case 1
in: [[1,2,3],[4,5,6]]
expected: -1
case 2
in: [[4,5,6],[1,2,3]]
expected: 1
case 3
in: [[1,2,3],[1,2,3]]
expected: 0
case 4
in: [[1,2,3],[2,2,4]]
expected: -0.3333333333333333
case 5
in: [[1,2],[1,2]]
expected: 0
Starter codePython
def cliffs_delta(x, y):
    # Your code here
    pass

5 test cases · run your code against them in the editor