Returns the
Line that is the best least squares
fit through the given set of points.
Namespace: Extreme.Mathematics.CurvesAssembly: Extreme.Numerics.Net40 (in Extreme.Numerics.Net40.dll) Version: 6.0.16073.0 (6.0.16312.0)
public static Line LeastSquaresFit(
double[] xValues,
double[] yValues
)
Public Shared Function LeastSquaresFit (
xValues As Double(),
yValues As Double()
) As Line
public:
static Line^ LeastSquaresFit(
array<double>^ xValues,
array<double>^ yValues
)
static member LeastSquaresFit :
xValues : float[] *
yValues : float[] -> Line
Parameters
- xValues
- Type: SystemDouble
An array of numbers containing the
X-coordinates of the points. - yValues
- Type: SystemDouble
An array of numbers containing the
Y-coordinates of the points.
Return Value
Type:
LineA
Line that is the least squares fit
through the given set of points.
The least squares fit of a line through a set
of points is the line that minimizes the sum of the
squares of the residuals. The residuals are the differences
between the predicted and the actual values.
The coordinates of the points are provided in
two Double arrays. These must have the
same number of elements, or an exception is thrown.
In rare cases, the least squares line is vertical
and the slope is infinite.In this case, a
DivideByZeroException exception is thrown.
Numerical Libraries
Supported in: 6.0, 5.x, 4.x
Reference