All problems
Exclusion Restriction Gap
Problem
Return the absolute difference in mean outcome between the two instrument levels among untreated units, a placebo check for the exclusion restriction. Return 0.0 for empty or mismatched input, or when either instrument level has no untreated units.
Hint
The instrument should not move outcomes for untreated units.
Test cases
case 1
in: [[1,1,0,0,1,0],[0,0,1,0,0,0],[5,7,20,3,6,4]]
expected: 2.5
case 2
in: [[1,0],[0,0],[2,4]]
expected: 2
case 3
in: [[1,1],[0,0],[2,4]]
expected: 0
case 4
in: [[1,0,1],[1,0,1],[1,2,3]]
expected: 0
case 5
in: [[0,1,1,0],[0,1,0,0],[1,2,3,4]]
expected: 0.5
Starter codePython
def exclusion_restriction_gap(instrument, treatment, outcome):
# Your code here
pass5 test cases · run your code against them in the editor