Processing math: 100%
Skip to main content

Section 2.4 Higher Degree Regression

Continuing in a similar fashion to the previous section, consider now an approximation using a quadratic function f(x)=ax2+bx+c. In this case, the total squared error would be of the form

TSE(a,b,c)=nk=0(ax2k+bxk+cyk)2.

Taking all three partials gives

TSEa=nk=12(ax2k+bxk+cyk)x2k
TSEb=nk=12(ax2k+bxk+cyk)xk
TSEc=nk=12(ax2k+bxk+cyk)1.

Once again, setting equal to zero and solving gives the normal equations for the best-fit quadratic

ank=1x4k+bnk=1x3k+cnk=1x2k=nk=1x2kyk
ank=1x3k+bnk=1x2k+cnk=1xk=nk=1xkyk
ank=1x2k+bnk=1xk+cnk=11=nk=1yk.

One can easily use software to perform these calculations of course. Further, you can extend the ideas from above and derivate formulas for a best-fit cubic. The interactive cell below determines the optimal quadratic polynomial for a given set of data points and by commenting and uncommenting as suggested will also determine the best fit cubic.