All problems
Risk Difference Pooling and NNT
Problem
Return [pooled, nnt] where pooled is the inverse-variance weighted risk difference sum(rd_i/var_i)/sum(1/var_i) and nnt = 1/|pooled|, or 0.0 when the pooled difference is zero. Return [0.0, 0.0] for empty or mismatched input or any variance <= 0.
Hint
Pooled NNT is the reciprocal of the absolute pooled risk difference.
Test cases
case 1
in: [[0.1,0.2],[0.01,0.01]]
expected: [0.15,6.666666666666667]
case 2
in: [[0.1,0.1,0.1],[0.04,0.01,0.0025]]
expected: [0.1,10]
case 3
in: [[0.2,0],[0.01,0.01]]
expected: [0.1,10]
case 4
in: [[0.05,-0.05],[0.01,0.01]]
expected: [0,0]
case 5
in: [[],[]]
expected: [0,0]
Starter codePython
def pool_risk_difference(rd, variances):
# Your code here
pass5 test cases · run your code against them in the editor