Click or drag to resize

BivariateLinearRegression 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
public static LinearRegressionResult LinearRegression(
	this IReadOnlyList<double> y,
	IReadOnlyList<double> x


Type: System.Collections.GenericIReadOnlyListDouble
The values of the dependent variables (y-coordinates).
Type: System.Collections.GenericIReadOnlyListDouble
The values of the independent variable (x-coordinates).

Return Value

Type: LinearRegressionResult
The 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 IReadOnlyListDouble. 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).
ArgumentNullExceptionx or y is .
DimensionMismatchExceptionx and y do not contain the same number of entries.
InsufficientDataExceptionThere are fewer than three data points.

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