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

Connected

Exercise

Linear regression on appropriate Anscombe data

For practice, perform a linear regression on the data set from Anscombe's quartet that is most reasonably interpreted with linear regression.

Instructions

100 XP
  • Compute the parameters for the slope and intercept using np.polyfit(). The Anscombe data are stored in the arrays x and y.
  • Print the slope and intercept.
  • Generate theoretical \(x\) and \(y\) data from the linear regression. Your \(x\) values should consist of 3 and 15.
  • Plot the Anscombe data as a scatter plot and the theoretical line.
  • Label the axes (just \(x\) and \(y\) will do).
  • Show your plot.