Skip to content
DeepForgeby svx
All problems
MediumStatisticsst-397

Bootstrap Percentile Interval

Problem

The percentile bootstrap interval takes the alpha/2 and 1 - alpha/2 quantiles of the sorted bootstrap statistics, using linear interpolation with position (n - 1) p.

Given the sorted statistics and alpha, return [lower, upper].

Hint

Interpolate between the two neighboring order statistics.

Test cases

case 1
in: [[1,2,3,4,5],0.2]
expected: [1.4,4.6]
case 2
in: [[0,1],0.5]
expected: [0.25,0.75]
case 3
in: [[-2,0,2],0.1]
expected: [-1.8,1.7999999999999998]
Starter codePython
def bootstrap_percentile_interval(sorted_stats, alpha):
    # Your code here
    pass

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