Regression Method

#1
I need to create a software algorithm to calculate cubic or quartic regression on an array of values, but it's been a while since my last stats class. I remember steps for linear regression with least squares, but I'm having a hard time finding steps to calculate the cubic or quartic regression. Essentially, I need to take their data points and generate a y=x type formula. If anyone could point me in the right direction I'd appreciate it. Thanks.
 
#3
Thanks for the tip Peter.

I found an old text book from the sixties that displayed a simple method. You can generate a system of equations to find a m order polynomial regression:

E(x) = sum(X)
n*b0+b1*E(x) + b2*E(x^2) + b3*E(x^3) + ... + bm*E(x^m) = E(y)
b0*E(x) + b1*E(x^2) + b2*E(x^3) + b3*E(x^4) + ... + bm*E(x^(m+1)) = E(y*x)
b0*E(x^2) + b1*E(x^3) + b2*E(x^4) + b3*E(x^5) + ... + bm*E(x^(m+2)) = E(y*x^2)
...........
b0*E(x^m) + b1*E(x^(m+1)) + b2*E(x^(m+2)) + b3*E(x^(m+3)) + ... + bm*E(x^2m) = E(y*x^m)

I then used linear algebra to solve for the constants and used those in a y=b0+b1*x+b2*x^2+...+bm*x^m equation.
I was able to create an algorithm for my program that would draw trend lines almost identical to Excel's.

The text was old, so if anyone knows of any flaws, as I'm a programmer and not a statician, please let me know. Thanks.
 
#5
The book I found it in was:
CRC
Standard Mathematical Tables
Student Edition
17th Edition

The spine is covered with our catalog info, but I believe it's by Selby.
If you can't find it and still want a scan of the pages, let me know.