Session Ready
Exercise

Fit a line

Continuing from the previous exercise:

  • Assume that xs and ys contain income codes and daily vegetable consumption, respectively, and

  • res contains the results of a simple linear regression of ys onto xs.

Now, you're going to compute the line of best fit. NumPy has been imported for you as np.

Instructions
100 XP
  • Set fx to the minimum and maximum of xs, stored in a NumPy array.
  • Set fy to the points on the fitted line that correspond to the fx.