Skip to main content

l1_regression_lp

Function l1_regression_lp 

Source
pub fn l1_regression_lp(x: &Matrix, y: &[f64]) -> Result<Vec<f64>, GeomError>
Expand description

Least-absolute-deviations regression, solved as a linear program.

Minimises sum |y_i - x_i . beta| by splitting each residual into a positive and a negative part. The result is far less sensitive to an outlier than a least-squares fit, because the cost of a large residual grows linearly rather than quadratically – an outlier at ten standard deviations pulls a hundred times harder on a least-squares fit than on this one.

x holds one row per observation. Add a column of ones for an intercept.

§Errors

Returns an error on a shape mismatch or if the program has no optimum.