Skip to content
DeepForgeby svx
All problems
HardStatisticsst-261

Paired Bootstrap Delta

Problem

Seed random with seed, resample item indices with replacement n_boot times, and return the percentile interval of mean(a) - mean(b) at alpha/2 and 1 - alpha/2 using linear interpolation. a and b are paired 0/1 outcome lists of equal length. Return [0.0, 0.0] when the inputs are empty, misaligned, or the parameters are invalid.

Hint

Use the same resampled index for both models so the comparison stays paired.

Test cases

case 1
in: [[1,1,0,1,0,1],[1,0,0,1,0,1],1000,99,0.05]
expected: [0,0.5]
case 2
in: [[1,0],[0,1],500,5,0.1]
expected: [-1,1]
case 3
in: [[],[],100,1,0.05]
expected: [0,0]
case 4
in: [[1,1],[1,1],200,2,0.05]
expected: [0,0]
Starter codePython
import random
def paired_bootstrap_delta(a, b, n_boot, seed, alpha):
    # Your code here
    pass

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