Skip to content
DeepForgeby svx
All problems
MediumML Fundamentalsml-198

Standardized Mean Difference

Problem

Compute the standardized mean difference between treated and control groups: (mean_t - mean_c) / sqrt((var_t + var_c)/2) using population variances.

Return 0.0 if a group is empty or the pooled standard deviation is 0.

Hint

SMD expresses the group difference in pooled standard deviation units, unlike a t-statistic.

Test cases

case 1
in: [[2,4,6],[1,3,5]]
expected: 0.6123724356957945
case 2
in: [[2,2],[2,2]]
expected: 0
case 3
in: [[10,12],[8,8,10]]
expected: 2.4009801919951244
Starter codePython
def standardized_mean_difference(treated, control):
    # Your code here
    pass

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