1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Linear Modeling in Python

Connected

Exercise

Visualize the Bootstrap

Continuing where we left off earlier in this lesson, let's visualize the bootstrap distribution of speeds estimated using bootstrap resampling, where we computed a least-squares fit to the slope for every sample to test the variation or uncertainty in our slope estimation.

To get you started, we've preloaded a function compute_resample_speeds(distances, times) to do the computation of generate the speed sample distribution.

Instructions

100 XP
  • Use the pre-defined compute_resample_speeds(distances, times) to compute the resample_speeds.
  • Use np.mean() to compute the speed_estimate from the resample_speeds.
  • Use np.percentile() with [5, 95] to compute the percentiles of resample_speeds, which define the confidence interval boundaries.
  • Use axis.hist() to plot the resample_speeds, specifying the bins with hist_bin_edges.
  • Using axis.axvline, specify the correct two indices of percentiles to mark the confidence interval boundaries on the chart.