Skip to content
DeepForgeby svx
All problems
EasyStatisticsst-148

Glass's Delta

Problem

Return Glass's delta (mean_x - mean_y) / s_y, standardizing by the sample standard deviation of the second group only. Return 0.0 when x is empty, y has fewer than two values, or s_y is zero.

Hint

Using the control SD avoids contamination by the treatment.

Test cases

case 1
in: [[1,2,3,4,5],[2,4,6,8,10]]
expected: -0.9486832980505138
case 2
in: [[10,12,14],[9,11,13]]
expected: 0.5
case 3
in: [[1,1,1],[2,2,2]]
expected: 0
case 4
in: [[5,5],[3,4]]
expected: 2.1213203435596424
case 5
in: [[1],[2,3]]
expected: -2.1213203435596424
Starter codePython
def glass_delta(x, y):
    # Your code here
    pass

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