[−][src]Function linreg::lin_reg
pub fn lin_reg<I, F>(xys: I, x_mean: F, y_mean: F) -> Result<(F, F), Error> where
I: Iterator<Item = (F, F)>,
F: FloatCore,
Calculates a linear regression with a known mean.
Lower-level linear regression function. Assumes that x_mean
and y_mean
have already been calculated. Returns Error::DivByZero
if
- the slope is too steep to represent, approaching infinity.
Since there is a mean, this function assumes that xs
and ys
are both non-empty.
Returns Ok((slope, intercept))
of the regression line.