Skip to content
DeepForgeby svx
All problems
HardStatisticsst-207

Egger Test Lite

Problem

Return the intercept of Egger's regression of the standardized effect y_i/se_i on precision 1/se_i. Return 0.0 when fewer than three studies are given, any se <= 0, or precision has zero variance.

Hint

A non-zero intercept suggests funnel plot asymmetry (small-study effects).

Test cases

case 1
in: [[1,0.8,1.2],[0.1,0.2,0.15]]
expected: -0.7142857142857144
case 2
in: [[0.5,0.5,0.5],[0.1,0.2,0.3]]
expected: 0
case 3
in: [[1,2,3],[1,1,1]]
expected: 0
case 4
in: [[1,1],[1,2]]
expected: 0
case 5
in: [[2,1,0.5,1.5],[0.1,0.3,0.2,0.5]]
expected: -4.2781557067271345
Starter codePython
def egger_intercept(yi, sei):
    # Your code here
    pass

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