# Re: Multiple polynomial regression

[ Follow Ups ] [ Post Followup ] [ Netlib Discussion Forum ] [ FAQ ]

Posted by Alan Miller on March 04, 1998 at 18:08:27:

In Reply to: Multiple polynomial regression posted by Chris Lloyd on March 02, 1998 at 09:42:22:

: Hello,

: I am a non mathematician so this question may seem a little
: simplistic, but I hope someone can help.

: I have been looking for some Fortran code for multiple
: polynomial least squares regression. I have data in an
: x,y,z format and I want to obtain residuals for each
: data point from trends of 1st, 2nd or 3rd order
: polynomials. There seems to be a vast amount of code
: for regression but I haven't been able to find any for
: straightforward multiple polynomial regression. I need
: code in Fortran as I want to call it from existing
: Fortran 77 code. Any suggestions as to where I might find
: Fortran code for this purpose would be greatly
: appreciated.

: Thanks in advance.

You can do this with any multiple regression
package - if I understand correctly what you are trying to do. Are you trying to fit say z as a polynomial in x and y. In multiple regression, you have a sequence of variables which we might call X1, X2, ... Xk. In you case, set X1 = x, X2 = y, X3 = x^2, X4 = x.y, X5 = y^2, etc.

Make sure that the regression package which you use employs an orthogonal reduction algorithm; there are some around which construct the normal equations. Your problem is almost certainly too ill-conditioned to use such methods. There is a least-squares package at my web site.

Cheers
Alan Miller