I hope you are excited about the skills you have learned about so far in this chapter. Now, we are going to learn how to fit curves using linear regression. One way to fit curves using a linear regression model is by building a polynomial, like this:
If we pay attention, we can see that the simple linear model is hidden in this polynomial. To uncover it, all we need to do is to make all the coefficients higher than one exactly zero. Then, we will get:
Polynomial regression is still linear regression; the linearity in the model is related to how the parameters enter the model, not the variables. Let's try building a polynomial regression of degree 2:
The third term controls the curvature of the relationship.
As a dataset, we are going to use the second group of the Anscombe quartet:
x_2 = ans[ans.group == 'II']['x'].values
y_2 ...