PDA

View Full Version : Regression Method

djshusko
06-13-2007, 09:20 AM
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.

PeterVincent
06-14-2007, 02:49 AM
Excel has one built in but if you need to build one from scratch...

http://www.grc.nasa.gov/WWW/price000/lap/htm/derivation_cubicregression.html

If you google you will find more

djshusko
06-14-2007, 01:21 PM
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.

PeterVincent
06-15-2007, 01:31 AM
Would like to see the method.

Would you be able to give me the book ref or a scan of the page?

Regards,

Peter

djshusko
06-15-2007, 01:34 PM
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.