All problems
Bootstrap-t Confidence Interval
Problem
Return the bootstrap-t confidence interval for the mean using n_boot resamples drawn with a self-contained Lehmer RNG seeded with seed (state = seed % 2147483647, next = state * 48271 % 2147483647). Convert z_crit to a tail probability with the normal CDF, take the alpha/2 and 1-alpha/2 percentiles of the studentized resample statistics with linear interpolation, and pivot them back to the mean scale. Return [0.0, 0.0] when n < 2 or n_boot <= 0.
Hint
Studentize each resample before taking percentiles.
Test cases
case 1
in: [[1,2,3,4,5],200,7,1.96]
expected: [0.7639320225002102,4.582887063211015]
case 2
in: [[10,20,30,40],300,99,1.645]
expected: [14.88700206305137,44.364916731037084]
case 3
in: [[5],10,1,1.96]
expected: [0,0]
case 4
in: [[],10,1,1.96]
expected: [0,0]
case 5
in: [[1,2],50,3,1.96]
expected: [1.5,1.5]
Starter codePython
import math
def bootstrap_t_ci(data, n_boot, seed, z_crit):
# Your code here
pass5 test cases · run your code against them in the editor