Function linreg::linear_regression_of[][src]

pub fn linear_regression_of<X, Y, F>(xys: &[(X, Y)]) -> Option<(F, F)> where
    X: Clone + Into<F>,
    Y: Clone + Into<F>,
    F: Float

Linear regression from tuples

Calculates the linear regression from a slice of tuple values.

Returns None if

  • x or y tuple members do not have a mean (e.g. if they are empty, see IteratorMean for details)
  • the slope is too steep to represent, approaching infinity

Returns Some(slope, intercept) of the regression line.