All problems
Breslow-Day Homogeneity Lite
Problem
Return a two-stratum Breslow-Day homogeneity statistic (ln OR1 - ln OR2)^2 / (se1^2 + se2^2), where se_i^2 = 1/a + 1/b + 1/c + 1/d for each 2x2 table. Return 0.0 when any cell is zero.
Hint
Large values suggest the stratum-specific odds ratios are not homogeneous.
Test cases
case 1
in: [[[10,20],[30,40]],[[5,15],[10,30]]]
expected: 0.27024978722164184
case 2
in: [[[20,80],[10,90]],[[30,70],[15,85]]]
expected: 0.019464733639750542
case 3
in: [[[10,10],[10,10]],[[5,5],[5,5]]]
expected: 0
case 4
in: [[[5,0],[1,1]],[[1,1],[1,1]]]
expected: 0
case 5
in: [[[1,2],[3,4]],[[1,2],[3,4]]]
expected: 0
Starter codePython
import math
def breslow_day_lite(t1, t2):
# Your code here
pass5 test cases · run your code against them in the editor