Skip to content
DeepForgeby svx
All problems
MediumStatisticsst-168

Hedges' g

Problem

Return Hedges' g, the small-sample corrected standardized mean difference: d * (1 - 3/(4*(n1+n2) - 9)), where d is Cohen's d with pooled variance. Return 0.0 when either sample has fewer than two values or the pooled variance is zero.

Hint

The correction factor removes upward bias in small samples.

Test cases

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

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