LinearRegression Type
This LinearRegression type summarized the most common fitting procedures.
Example
// e.g. days since experiment start
let xData = vector [|1. .. 100.|]
// e.g. plant size in cm
let yData = vector [|4.;7.;8.;9.;7.;11.; ...|]
// Estimate the intercept and slope of a line, that fits the data.
let coefficientsSimpleLinear =
LinearRegression.fit(xData,yData,FittingMethod=Fitting.Method.SimpleLinear,Constraint=Fitting.Constraint.RegressionThroughOrigin)
// Predict the size on day 10.5
LinearRegression.predict(coefficientsSimpleLinear) 10.5
Constructors
| Constructor | Description |
|
|
Static members
| Static member | Description |
Full Usage:
LinearRegression.fit (xData, yData, ?FittingMethod)
Parameters:
Matrix<float>
-
matrix of x vectors
yData : Vector<float>
-
vector of y values
?FittingMethod : Method
-
Multivariate regression currently just supports Fitting.SimpleLinear (straight line).
Returns: Coefficients
Linear regression coefficients for multivariate regression.
|
Default is simple linear regression fitting without constraints.
Example
val xData: obj
val yData: obj
val coefficientsSimpleLinear: obj
|
Full Usage:
LinearRegression.fit (xData, yData, ?FittingMethod, ?Constraint, ?Weighting)
Parameters:
Vector<float>
-
vector of x values
yData : Vector<float>
-
vector of y values
?FittingMethod : Method
-
Either Fitting.SimpleLinear (straight line), Fitting.Polynomial (polynomial), or Fitting.Robust (outlier insensitive straight line).
?Constraint : Constraint<float * float>
-
Either Fitting.Unconstrained, Fitting.RegressionThroughOrigin, or Fitting.RegressionThroughXY (x,y) with x,y beeing coordinates that the line must pass.
?Weighting : Vector<float>
-
If a pointwise weight should be attached, a weight vector can be given, that is in the same order as x/y values.
Returns: Coefficients
Linear regression coefficients.
|
Default is simple linear regression fitting without constraints.
Example
val xData: obj
val yData: obj
val coefficientsSimpleLinear: obj
val coefficientsPolynomial: obj
val coefficientsRobust: obj
|
Full Usage:
LinearRegression.predict coeff xValue
Parameters:
Coefficients
-
Linear regression coefficients (e.g. from LinearRegression.fit())
xValue : float
-
x value of which the corresponding y value should be predicted
Returns: float
Prediction function that takes an x value and predicts its corresponding y value.
|
Example
val xData: obj
val yData: obj
val coefficientsSimpleLinear: obj
|
Full Usage:
LinearRegression.predictMultivariate coeff xVector
Parameters:
Coefficients
-
Multivariate linear regression coefficients (e.g. from LinearRegression.fit())
xVector : Vector<float>
-
x value of which the corresponding y value should be predicted
Returns: float
Prediction function that takes an x vector and predicts its corresponding y value.
|
Example
val xVectorMulti: obj
val yVectorMulti: obj
val transformX: x: 'a -> 'b
val x: 'a
val coefficientsSimpleLinear: obj
|
FSharp.Stats