All problems
Transformed Outcome
Problem
Compute the transformed outcome for a constant propensity p: y * (t - p) / (p * (1 - p)), clipping p to [1e-6, 1 - 1e-6].
Empty input returns [].
Hint
The transformed outcome is unbiased for the treatment effect under the true propensity.
Test cases
case 1
in: [[1,1,0],[1,1,0],[0.5,0.5,0.5]]
expected: [2,2,0]
case 2
in: [[1,0],[1,0],[0.8,0.8]]
expected: [1.25,0]
case 3
in: [[1,1],[1,1],[1,1]]
expected: [1.000001000001,1.000001000001]
case 4
in: [[],[],[]]
expected: []
Starter codePython
def transformed_outcome(y, treatment, propensity):
# Your code here
pass4 test cases · run your code against them in the editor