Skip to content
DeepForgeby svx
All problems
MediumStatisticsst-277

ATT via Propensity Odds

Problem

Return the average treatment effect on the treated using propensity odds weighting: the treated mean minus the odds-weighted control mean, where a control unit with propensity e gets weight e/(1-e). Return 0.0 for empty or mismatched input, when there are no treated units or no usable controls, or when a control has propensity at least 1.

Hint

Controls that look like the treated group carry more weight.

Test cases

case 1
in: [[1,1,0,0],[10,12,4,6],[0.6,0.7,0.3,0.5]]
expected: 5.6
case 2
in: [[1,0],[5,1],[0.5,0.5]]
expected: 4
case 3
in: [[0,0],[1,2],[0.2,0.3]]
expected: 0
case 4
in: [[1,0],[5,1],[0.6,1]]
expected: 0
case 5
in: [[1,1,0],[2,4,1],[0.4,0.6,0.2]]
expected: 2
Starter codePython
def att_estimate(treatment, outcome, propensity):
    # Your code here
    pass

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