Skip to content
DeepForgeby svx
All problems
MediumStatisticsst-121

AIPW Estimate

Problem

Return the augmented IPW estimate of the treated mean, (1/n)*sum(mu1_i + t_i*(y_i - mu1_i)/e_i), where mu1_i is the outcome model prediction. Return 0.0 when lengths differ, a treated unit has e_i <= 0, or the input is empty.

Hint

The model predictions are corrected by the weighted residuals.

Test cases

case 1
in: [[1,0,1,0],[10,5,8,4],[0.5,0.5,0.4,0.6],[9,6,7,5]]
expected: 7.875
case 2
in: [[1],[7],[0.7],[6]]
expected: 7.428571428571429
case 3
in: [[0,0],[1,2],[0.2,0.3],[1.5,2.5]]
expected: 2
case 4
in: [[],[],[],[]]
expected: 0
case 5
in: [[1],[5],[0],[1]]
expected: 0
Starter codePython
def aipw_estimate(treatment, outcome, propensity, mu1):
    # Your code here
    pass

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