RTO Module

Fits straight regression lines through the origin f(x) = bx.

Functions and values

Function or value Description

coefficient xData yData

Full Usage: coefficient xData yData

Parameters:
    xData : seq<float> - vector of x values
    yData : seq<float> - vector of y values

Returns: float Slope of the regression line through the origin

Calculates the slope of a regression line through the origin

xData : seq<float>

vector of x values

yData : seq<float>

vector of y values

Returns: float

Slope of the regression line through the origin

Example

 
 // e.g. days since a certain event
 let xData = vector [|0.;1.;2.;3.;4.;5.;|]
 // some measured feature, that theoretically is zero at day 0
 let yData = vector [|1.;5.;9.;13.;17.;18.;|]
 
 // Estimate the slope of the regression line.
 let coefficients = 
     LinearRegression.OrdinaryLeastSquares.Linear.RTO.coefficient xData yData

coefficientOfVector xData yData

Full Usage: coefficientOfVector xData yData

Parameters:
    xData : Vector<float> - vector of x values
    yData : Vector<float> - vector of y values

Returns: float Slope of the regression line through the origin

Calculates the slope of a regression line through the origin

xData : Vector<float>

vector of x values

yData : Vector<float>

vector of y values

Returns: float

Slope of the regression line through the origin

Example

 
 // e.g. days since a certain event
 let xData = vector [|0.;1.;2.;3.;4.;5.;|]
 // some measured feature, that theoretically is zero at day 0
 let yData = vector [|1.;5.;9.;13.;17.;18.;|]
 
 // Estimate the slope of the regression line.
 let coefficients = 
     LinearRegression.OrdinaryLeastSquares.Linear.coefficient xData yData

fit coef x

Full Usage: fit coef x

Parameters:
    coef : float - The functions slope
    x : float - x value of which the corresponding y value should be predicted

Returns: float predicted y value

Predicts the y value for a given slope and x value (intercept=0)

coef : float

The functions slope

x : float

x value of which the corresponding y value should be predicted

Returns: float

predicted y value

Example

 
 let mySlope = 17.8

 // Returns predicted y value at x=6 using a line with intercept=0 and slope=17.8
 LinearRegression.OrdinaryLeastSquares.Linear.RTO.fit mySlope 6.

fitFunc coef x

Full Usage: fitFunc coef x

Parameters:
    coef : float - The functions slope
    x : float

Returns: float Function that takes a x value and returns the predicted y value

Returns the regression function of a line through the origin

coef : float

The functions slope

x : float
Returns: float

Function that takes a x value and returns the predicted y value

Example

 
 let mySlope = 17.8

 // get the f�tting function that fits through the origin
 let myF = 
     LinearRegression.OrdinaryLeastSquares.Linear.RTO.fitFunc mySlope

 // Returns predicted y value at x=6 using a line with intercept=0 and slope=17.8
 myF 6.