PDA

View Full Version : Cubic Regression - Math/Numerical Question

Davros
04-27-2005, 10:35 AM
Hi there,

How do I implement cubic regression? I.e. given a series of x-y data points, how do I find the coefficients:

y = ax^3 + bx^2 + cx + d

Am aware that if I differentiate twice, I get:

d2y/dsx2 = 6ax + 2b

so if I can numerically differentiate my x-y data twice, I can find constants a & b by linear regression.

How do I go about differentiating the data. And how do I find constants c & d?

Or is there a better approach?

joshdick
04-27-2005, 10:57 AM
http://en.wikipedia.org/wiki/Linear_regression

This gets into Linear Algebra.

Davros
04-27-2005, 11:06 AM
Thanks for the reply.

>This gets into Linear Algebra.

I can do the linear regression bit. But...

how do I transform a cubic in order to determine all the constants?

Sang-drax
04-27-2005, 02:26 PM
http://www.efunda.com/math/leastsquares/lstsqrmdcurve.cfm
http://www.efunda.com/math/leastsquares/leastsquares.cfm

These pages seem good, there's a linear example as well.

To do this in MATLAB, use the polyfit() function.

The Brain
04-27-2005, 02:47 PM
why not just use the cubic regression from your TI-83 ? :cool:

Davros
04-27-2005, 03:02 PM