Skip to content
DeepForgeby svx
All problems
EasyStatisticsst-149

Odds Ratio to d

Problem

Convert an odds ratio to a standardized mean difference with d = ln(OR) * sqrt(3) / pi. Return 0.0 when the odds ratio is not positive.

Hint

The logit scale converts to the d scale by sqrt(3)/pi.

Test cases

case 1
in: [1]
expected: 0
case 2
in: [2.25]
expected: 0.4470892603707035
case 3
in: [0.5]
expected: -0.3821520694228441
case 4
in: [10]
expected: 1.2694816959350916
case 5
in: [0]
expected: 0
Starter codePython
import math
def odds_ratio_to_d(odds_ratio):
    # Your code here
    pass

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