All problems
Random-Effects Meta Mean
Problem
Return the DerSimonian-Laird random-effects pooled mean using weights 1/(se_i^2 + tau2), where tau2 = max(0, (Q - (k-1)) / (sum(w) - sum(w^2)/sum(w))) and Q is the fixed-effect Cochran statistic. Return 0.0 when fewer than two studies are given, any se <= 0, or the heterogeneity denominator is not positive.
Hint
Adding tau-squared to each variance downweights small, noisy studies.
Test cases
case 1
in: [[1,1.2],[0.1,0.1]]
expected: 1.0999999999999999
case 2
in: [[0.5,0.3,0.7],[0.1,0.2,0.15]]
expected: 0.5220856225860849
case 3
in: [[0.5,0.6],[0.05,0.5]]
expected: 0.500990099009901
case 4
in: [[1],[0.1]]
expected: 0
case 5
in: [[0.1,0.2],[0,0.1]]
expected: 0
Starter codePython
def random_effects_meta(yi, sei):
# Your code here
pass5 test cases · run your code against them in the editor