You are here: Start » Filter Reference » Regression Analysis » LinearRegression
Computes linear regression of given point set.
| Name | Type | Description | |
|---|---|---|---|
![]()  | 
				inYValues | RealArray | Sequence of ordinates | 
![]()  | 
				inXValues | RealArray* | Sequence of abscissae, or {0, 1, 2, ...} by default | 
![]()  | 
				outLinearFunction | LinearFunction | Linear function approximating the given point set | 
![]()  | 
				outEstimatedValues | RealArray | The result of application of the computed function to the X values | 
![]()  | 
				outResiduals | RealArray | Difference between an input Y value and the corresponding estimated value | 
![]()  | 
				outRSquared | Real | 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
This filter can throw an exception to report error. Read how to deal with errors in Error Handling.
List of possible exceptions:
| Error type | Description | 
|---|---|
| DomainError | Inconsistent size of arrays in LinearRegression. | 
Complexity Level
This filter is available on Basic Complexity Level.
Filter Group
This filter is member of LinearRegression filter group.


