Function linreg::linear_regression [−][src]
pub fn linear_regression<X, Y, F>(xs: &[X], ys: &[Y]) -> Option<(F, F)> where
X: Clone + Into<F>,
Y: Clone + Into<F>,
F: Float,
Linear regression from two slices
Calculates the linear regression from two slices, one for x- and one for y-values.
Returns None if
xsandysdiffer in lengthxsorysdo not have a mean (e.g. if they are empty, seeIteratorMeanfor details)- the slope is too steep to represent, approaching infinity
Returns Some(slope, intercept) of the regression line.