Understanding polynomial regression

1k Views Asked by At

I'm looking for a good tutorial on how to calculate a "line of best fit" for non-linear data.

I found this site: http://easycalculation.com/statistics/learn-regression.php which gives a very good tutorial on calculating a linear equation, but I can't seem to find a similar guide for non-linear data.

The closest I could find was this: http://www.arachnoid.com/sage/polynomial.html which starts out promising, but I began to understand less and less as it continued (compared to linear regression, where the most difficult concept to grasp was squares and sums).

I have very little mathematical education, so that's the stumbling block here. Are there any simple means of calculating polynomial regression (I believe that's the term), or is it probably above my head if I don't understand the second link?

(I'm creating a program to calculate and use the equation)

Thank you

1

There are 1 best solutions below

1
On BEST ANSWER

Let $$ X = \begin{bmatrix} 1 & x_1 & x_1^2 \\ \vdots & \vdots & \vdots \\ 1 & x_n & x_n^2 \end{bmatrix}. $$ Let $$ Y = \begin{bmatrix} y_1 \\ \vdots \\ y_n \end{bmatrix}. $$ Then the three entries in the $3\times 1$ matrix $(X^T X)^{-1}X^TY$ are the least-squares estimates of the coefficients in $y = \alpha+\beta x+\gamma x^2$.

To use this, you would need to be able to do transposition, inversion, and multiplication of matrices.