Using Multiple Independent Variables
The CLsqFit class can fit data having between 1 and 10 independent variables, or basis dimensions. For example, fitting a curve to (x,y) pairs estimates the function y(x) and involves 1 independent variable, x, and an observation, y, which is the observed value at coordinate x. Fitting a surface z(x,y) involves 2 independent variables, x and y. The independent variables are specified as basis dimension 1 for y(x) and as basis dimensions 1 and 2 for z(x,y). The CLsqFit class accommodates up to 10 basis dimensions, or independent variables. It also fits up to 100 coefficients which may be mixed among the variables. The interaction between coefficients and basis dimensions is controlled by the basis function. Some examples will illustrate this concept. Coefficients are represented by a[n] where n is in the range 1 through 100.
|
Fitting a general polynomial curve y = f(x) involves 1 basis dimension for x but n coefficients in a polynomial of degree n. The equation being fit is y = a[1] + a[2] x + ... + a[n] x^(n-1). Notes on other functions: |
|
|
|
As can be seen from these examples, higher order multi-dimensional fits may involve complicated equations. Thus the CLsqFit class includes 2 useful built-in fitting functions: an n-dimensional polynomial fit of up to 100 terms including all cross terms, and a hyperplane function for fitting up to 10 independent variables of first power only. Other basis functions can be specified by writing them as a script function; see Basis Functions and the SetBasisFunc method.