All problems
Bootstrap CI for ATE
Problem
Return the percentile bootstrap confidence interval for the average treatment effect. Resample the treated and control outcomes separately with replacement using the seeded Lehmer RNG, compute the difference of means each time, and return the alpha/2 and 1-alpha/2 percentiles with linear interpolation. Return [0.0, 0.0] when either group is empty, lengths differ, or n_boot <= 0.
Hint
Resample within arms to respect the treatment design.
Test cases
case 1
in: [[10,12,9,11,5,6,4,7],[1,1,1,1,0,0,0,0],200,7,0.05]
expected: [3.4937500000000004,6.256250000000001]
case 2
in: [[1,2],[1,0],100,3,0.1]
expected: [-1,-1]
case 3
in: [[1],[1],50,1,0.05]
expected: [0,0]
case 4
in: [[],[],10,1,0.05]
expected: [0,0]
case 5
in: [[1,2,3,4],[1,0,1,0],100,42,0.1]
expected: [-3,1]
Starter codePython
def bootstrap_ate_ci(y, treatment, n_boot, seed, alpha):
# Your code here
pass5 test cases · run your code against them in the editor