Session Ready
Exercise

Bootstrapping a confidence interval

A useful tool for assessing the variability of some data is the bootstrap. In this exercise, you'll write your own bootstrapping function that can be used to return a bootstrapped confidence interval.

This function takes three parameters: a 2-D array of numbers (data), a list of percentiles to calculate (percentiles), and the number of boostrap iterations to use (n_boots). It uses the resample function to generate a bootstrap sample, and then repeats this many times to calculate the confidence interval.

Instructions
100 XP
  • The function should loop over the number of bootstraps (given by the parameter n_boots) and:
    • Take a random sample of the data, with replacement, and calculate the mean of this random sample
    • Compute the percentiles of bootstrap_means and return it