Solved – What makes linear regression with polynomial features curvy

polynomialregression

The following is my understanding of what happens: if I take a "two dimensional problem" e.g. I have $X$ as inputs and Y as the outcome and I add a feature $x^2$. This gives a problem an additional dimension and the linear fit on the $x$ and $y$ values define a line as well as the linear fit on $x^2$ and $y$ values and the two lines define a plane which is the best fit. Is this correct? How does this translate back to the 2 dimensional space? Does this somehow show up in two dimensions as curvy? How?

Best Answer

This is a piece of a plane in 3D.

Figure 1

Here is the same plane with coordinates shown and a set of points selected along its $x$ axis.

Figure 2

The third coordinate is used to plot the squares of these $x$ values, producing points along a parabola at the base of the coordinate box.

Figure 3

A vertical "curtain" through the parabola intersects the plane at all the points directly above the parabola. This intersection is a curve.

Figure 4

A polynomial model supposes the response $y$ (graphed in the vertical direction) differs from the height of this plane by random amounts. The values of $y$ corresponding to these $x$ coordinates are shown as red dots.

Figure 5

Consequently, the $(x,y)$ points lie along a curve--this projection--rather than a line, even though the model of the response is based on the plane originally shown.

Figure 6

Moral

When the explanatory variables clearly lie on a curve, the responses will appear to lie on a curve, too.