Skip to content
DeepForgeby svx
All problems
HardML Fundamentalsml-135

Bootstrap Standard Error

Problem

Compute the bootstrap standard error of the mean. Call random.seed(seed) and draw num_samples resamples of size n with replacement (random.randrange), then return the population standard deviation of the resample means.

Empty data or non-positive num_samples returns 0.0.

Hint

Standard error is the standard deviation of the bootstrap distribution of the mean.

Test cases

case 1
in: [[1,2,3,4,5,6,7,8],200,42]
expected: 0.8154140052758475
case 2
in: [[10,12,11,13,12],100,7]
expected: 0.4281074631444773
case 3
in: [[5],50,1]
expected: 0
case 4
in: [[],10,0]
expected: 0
Starter codePython
import random
def bootstrap_standard_error(data, num_samples, seed):
    # Your code here
    pass

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