Questa è più una risposta al commento di @ PeterFlom sul mio commento, ma è troppo grande per entrare in un commento (e si riferisce alla domanda originale).
Ecco un po 'di codice R da mostrare un caso in cui ci sono più righe che danno tutti gli stessi valori MAD / SAD minimi.
La prima parte dell'esempio è chiaramente un dato inventato per dimostrare, ma la fine include più di un elemento casuale per dimostrare che il concetto generale sarà ancora valido in alcuni casi più realistici.
x <- rep (1:10, each = 2) y <- x / 10 + 0: 1plot (x, y) sad <- funzione (x, y, coef) {# mad is sad / n yhat <- coef [1] + coef [2] * x resid <- y - yhat sum (abs (resid))} libreria (quantreg) fit0 <- rq (y ~ x) abline (fit0) fit1 <- lm (y ~ x, subset = c (1,20)) fit2 <- lm (y ~ x, subset = c (2,19)) fit3 <- lm (y ~ x, subset = c (2,20)) fit4 <- lm (y ~ x, subset = c (1,19)) fit5.coef <- c (0,5, 1/10) abline ( fit1) ablin e (fit2) abline (fit3) abline (fit4) abline (fit5.coef) for (i in seq (-0.5, 0.5, by = 0.1)) {abline (fit5.coef + c (i, 0))} tmp1 <- seq (coef (fit1) [1], coef (fit2) [1], len = 10) tmp2 <- seq (coef (fit1) [2], coef (fit2) [2], len = 10) per (i in seq_along (tmp1)) {abline (tmp1 [i], tmp2 [i])} sad (x, y, coef (fit0)) sad (x, y, coef (fit1)) sad (x, y, coef (fit2)) sad (x, y, coef (fit3)) sad (x, y, coef (fit4)) sad (x, y, fit5.coef) for (i in seq (-0.5, 0.5, by = 0.1)) {print (sad (x, y, fit5.coef + c (i, 0)))} for (i in seq_along (tmp1)) {print (sad (x, y, c (tmp1 [i], tmp2 [i])))} set.seed (1) y2 <- y + rnorm (20,0,0.25) plot (x, y2) fitnew <- rq (y2 ~ x) # nota il warningabline ancora non univoco (fitnew) abline (coef (fitnew) + c (.1,0)) abline (coef (fitnew) + c (0, 0.01)) sad (x, y2, coef (fitnew)) sad (x, y2, coef (fitnew) + c (.1,0)) sad (x, y2, coef (fitnew) + c (0,0.01))