Skip to content
DeepForgeby svx
All problems
EasyStatisticsst-281

Collider Bias Direction

Problem

Conditioning on a collider that is a common effect of treatment and outcome induces association between them. Return the sign of that induced bias as -1 * sign(treatment_to_collider) * sign(outcome_to_collider), where the inputs are the signed path coefficients. Return 0 when either path coefficient is zero.

Hint

Two positive arrows into the collider create a negative bias.

Test cases

case 1
in: [1,1]
expected: -1
case 2
in: [1,-1]
expected: 1
case 3
in: [-1,-1]
expected: -1
case 4
in: [0,1]
expected: 0
case 5
in: [2,3]
expected: -1
Starter codePython
def collider_bias_direction(treatment_to_collider, outcome_to_collider):
    # Your code here
    pass

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