1. Learn
  2. /
  3. Courses
  4. /
  5. Statistical Thinking in Python (Part 2)

Connected

Exercise

Bootstrap replicates of other statistics

We saw in a previous exercise the the mean is Normally distributed. This does not necessarily hold for other statistics, but no worry: as hackers, we can always take bootstrap replicates! Generate bootstrap replicates for the variance of the annual rainfall at the Sheffield Weather Station and plot the histogram of the replicates.

Here, you will make use of the draw_bs_reps() function you defined a few exercises ago. It is provided below for your reference:

def draw_bs_reps(data, func, size=1):
    return np.array([bootstrap_replicate_1d(data, func) for _ in range(size)])

Instructions

100 XP
  • Draw 10,000 bootstrap replicates of the variance in annual rainfall using your draw_bs_reps() function. Hint: Pass in np.var for computing the variance.
  • Divide you variance replicates by 100 to put the variance in units of square centimeters for convenience.
  • Make a histogram of the replicates using the normed=True keyword argument and 50 bins. Be sure to label the axes.
  • Show your plot.