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

Connected

Exercise

Displaying the linear regression results

Now, you will display your linear regression results on the scatter plot, which is already pre-generated for you from your previous exercise. To do this, take the first 100 bootstrap samples (stored in bs_slope_reps_1975, bs_intercept_reps_1975, bs_slope_reps_2012, and bs_intercept_reps_2012) and plot the lines with alpha=0.2 and linewidth=0.5 keyword arguments to plt.plot().

Instructions

100 XP
  • Generate the \(x\)-values for the bootstrap lines. They should consist of 10 mm and 17 mm.
  • Write a for loop to plot 100 of the bootstrap lines for the 1975 and 2012 data sets. The lines for the 1975 data set should be blue and those for the 2012 data set should be red.
  • Hit 'Submit Answer` to view the plot!