Bivariate.LinearRegression Method |
Computes the best-fit linear regression from the data.
Namespace:
Meta.Numerics.Statistics
Assembly:
Meta.Numerics (in Meta.Numerics.dll) Version: 4.1.4
Syntax public static LinearRegressionResult LinearRegression(
this IReadOnlyList<double> y,
IReadOnlyList<double> x
)
<ExtensionAttribute>
Public Shared Function LinearRegression (
y As IReadOnlyList(Of Double),
x As IReadOnlyList(Of Double)
) As LinearRegressionResult
public:
[ExtensionAttribute]
static LinearRegressionResult^ LinearRegression(
IReadOnlyList<double>^ y,
IReadOnlyList<double>^ x
)
[<ExtensionAttribute>]
static member LinearRegression :
y : IReadOnlyList<float> *
x : IReadOnlyList<float> -> LinearRegressionResult
Parameters
- y
- Type: System.Collections.Generic.IReadOnlyList<Double>
The values of the dependent variables (y-coordinates). - x
- Type: System.Collections.Generic.IReadOnlyList<Double>
The values of the independent variable (x-coordinates).
Return Value
Type:
LinearRegressionResultThe result of the fit.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
IReadOnlyList<Double>. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
Exceptions Remarks Linear regression assumes that the data have been generated by a function y = a + b x + e, where e is
normally distributed noise, and determines the values of a and b that best fit the data. It also
determines a covariance matrix on the parameters a and b, and computes an ANOVA analysis of the fit.
See Also