The method of LEAST SQUARES is used in the program to fit a multivariable polynomial to a tabulated function. The values of tabulated functions must be taken for values of the independent variables belonging to a rectangular grid which may be unevenly spaced, that is, a function of n variables must be tabulated at the nodes of an n-dimensional rectangular grid. For example, if x and y are the independent variables, we may, for instance, have 6 values of x and 5 values of y and 30 values of the function, one for each (x,y) combination, and the grid may look like:
To illustrate, suppose we have a tabulated function with 2 independent variables and with N data sets and we wish to fit to it a polynomial of first degree in x and second degree in y. The polynomial to be fitted is then
z = a0+a1x+b0y+b1xy+c1y2+c1xy2 = (a0+a1x)+(b0+b1x)y+(c0+c1x)y2
where a0, a1, b0, b1, c0, c1 are the coefficients to be determined. To minimize the residuals by the least squares method we have to solve the following set of normal equations:
åz = a0å1 +a1åx +b0åy +b1åxy +c0åy2 +c1åxy2
åxz = a0åx +a1åx2 +b0åxy +b1åx2y +c0åxy2 +c1åx2y2
åyz = a0åy +a1åxy +b0åy2 +b1åxy2 +c0åy3 +c1åxy3
åxyz = a0åxy +a1åx2y +b0åxy2 +b1åx2y2 +c0åxy3 +c1åx2y3
åy2z = a0åy2 +a1åxy2 +b0åy3 +b1åxy3 +c0åy4 +c1åxy4
åxy2z = a0åxy2 +a1åx2y2 +b0åxy3 +b1åx2y3 +c0åxy4 +c1åx2y4
where the summations are over all N data sets, that is, from 1 to N.
The system may be solved as it stands,
especially since we have only 6 equations.
However, had we wanted, for instance, a polynomial of 5th
degree in x and 6th degree in
y, we would already be dealing with 42
equations. Furthermore, if you have 10 values for
x and 10 values for
y , you would have 100 data sets
over which to perform the above summations.
But the program takes advantage of the fact that the
grid is rectangular to shorten the computations. An example of a tabulated function with one evenly spaced variable and one
unevenly spaced is:
The correlation coefficient is computed with
[festimated - fmean]2
where the summations are over all data points.
The standard error of estimate is calculated using
[f - festimated ]2
where the summations are also over all data points.
The festimated is found using the regression curve.
Copyright © 2001-2010 Numerical Mathematics. All rights reserved.