WebCab Probability and Statistics for Delphi (COM) v3.6

GeneralLinearEasy.TrendLinePolynomial Method (Double[], Double[], Int32)

Fits a polynomial of a given degree to a data set in accordance with the least squares approach and returns the values of the fitted function for the x-coordinate values of the data set.

public double[] TrendLinePolynomial(
   double[] xData,
   double[] yData,
   int degree
);

Parameters

xData
An array where the k-th element is the value of the x-coordinate of the k-th data point.
yData
An array where the k-th element is the value of the y-coordinate of the k-th data point.
degree
The degree of the polynomial which is fitted to the data set given (i.e. if degree is 2, then a quadratic is fitted).

Return Value

An array where the k-th value is the value in the y-coordinate of the fitted function at the value of the x-coordinate of the k-th data point.

Remarks

For example, if we fit a polynomial of degree 2, then we will fit the quadratic polynomial (i.e. f(x) = a0 + a1 x + a2 x2); similarly if we fit a polynomial of degree 3, then we fit the cubic polynomial (i.e. f(x) = a0 + a1 x + a2 x2 + a3 x3).

See Also

GeneralLinearEasy Class | WebCab.COM.Statistics.CurveFitting Namespace | GeneralLinearEasy.TrendLinePolynomial Overload List | Allows the values of the fitted function to be evaluated over an extended range. That is, a range in the x-coordinate greater than the original given data set.