Click or drag to resize
LinearRegression Class
The LinearRegression class performs a simple linear regression on an set of N data points (Yi, Xi). That is, it fits a straight line Y = α + β X, (where Y is the response variable, X is the predictor variable, α is the Y-intercept, and β is the Slope) that minimizes the sum of squared residuals of the linear regression model. It also computes associated statistics, including the coefficient of determination R2 and the standard deviation of the estimates for the slope and Y-intercept.
Inheritance Hierarchy
SystemObject
  Algs4NetLinearRegression

Namespace: Algs4Net
Assembly: Algs4Net (in Algs4Net.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
public class LinearRegression

The LinearRegression type exposes the following members.

Constructors
  NameDescription
Public methodLinearRegression
Performs a linear regression on the data points (y[i], x[i]).
Top
Properties
  NameDescription
Public propertyIntercept
Returns the Y-intercept α of the best of the best-fit line Y = α + β X.
Public propertyInterceptStdErr
Returns the standard error of the estimate for the intercept.
Public propertyR2
Returns the coefficient of determination R2.
Public propertySlope
Returns the slope β of the best of the best-fit line Y = α + β X.
Public propertySlopeStdErr
Returns the standard error of the estimate for the slope.
Top
Methods
  NameDescription
Public methodStatic memberMainTest
Demo test the LinearRegression data type.
Public methodPredict
Returns the expected response y given the value of the predictor variable x.
Public methodToString
Returns a string representation of the simple linear regression model.
(Overrides ObjectToString.)
Top
See Also