RTO Module

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

Functions and values

Function or value Description

fit xData yData

Full Usage: fit xData yData

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

Returns: Coefficients 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: Coefficients

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.OLS.Linear.RTO.fit xData yData

fitOfVector xData yData

Full Usage: fitOfVector xData yData

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

Returns: Coefficients 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: Coefficients

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.OLS.Linear.fit xData yData

predict coef x

Full Usage: predict coef x

Parameters:
    coef : Coefficients - 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 : Coefficients

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.OLS.Linear.RTO.predict mySlope 6.

predictFunc coef x

Full Usage: predictFunc coef x

Parameters:
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 : Coefficients

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.OLS.Linear.RTO.predictFunc mySlope
   
   // Returns predicted y value at x=6 using a line with intercept=0 and slope=17.8
   myF 6.