You are here: Start » AVL.NET » AVL.LinearRegression Method
AVL.LinearRegression Method
Computes linear regression of given point set.
| Namespace: | AvlNet |
|---|---|
| Assembly: | AVL.NET.dll |
Syntax
public static void LinearRegression( float[] inYValues, out AvlNet.LinearFunction outLinearFunction, out float[] outEstimatedValues, out float[] outResiduals, out float outRSquared )
Parameters
| Name | Type | Range | Default | Description | |
|---|---|---|---|---|---|
![]() | inYValues | float | Sequence of ordinates. | ||
![]() | outLinearFunction | AvlNet.LinearFunction | Linear function approximating the given point set. | ||
![]() | outEstimatedValues | float | The result of application of the computed function to the X values. | ||
![]() | outResiduals | float | Difference between an input Y value and the corresponding estimated value. | ||
![]() | outRSquared | float | Coefficient of determination of output function. |
Description
The operation fits a straight line through the set of points in such a way, that sum of squared distances (residuals) between points and fitted line is as small as possible.
Fitted line parameters are calculated as follows:
\[B=\frac{ { n\sum\limits_{ i=0 }^n{ x_{i}y_{i} } } - \sum\limits_{i=0}^n{x_{i} }\sum\limits_{i=0}^n{y_{i} } }{n\sum\limits_{i=0}^n{x_{i}^2}-{\sum\limits_{i=0}^n{x} }^2} \]
\[A=\frac{ {}\sum\limits_{i=0}^n{x_{i} } }{n}-B\frac{\sum\limits_{i=0}^n{y_{i} } }{n}\]
Errors
| Error type | Description |
|---|---|
| DomainError | Inconsistent size of arrays in LinearRegression. |


