Is there any closed formula for quantile regression with only one predictor?

I need to implement in SQL median regression with one predictor. It is quite easy to implement OLS with one predictor, because there is simple formulat for coefficients, but I have no idea how whether there is a formula for quantile regression.


No, quantile regression in general (even with only 1 predictor) does not have a closed form solution and sometimes does not even have a unique solution. See my answer here for an example.

One algorythm for finding the line (at least for the median/50% quantile) is to find all pairs of points and fit the lines going through those 2 points, then compute the sum of absolute deviations and return the line (or one of the lines) with the smallest. That may be programmable in SQL (though requiring much better skills than I have).

  • $\begingroup$ Is there a relation that median regression goes through at least k+1 points? K is number of parameters without constant. $\endgroup$ Feb 1 '13 at 8:15
  • $\begingroup$ It does not have to (see the other example where many of the lines don't touch any points). But the basic algrorithm described to find an answer would look at combinations of k+1 points. I don't know how efficient this would be as k increases. $\endgroup$
    – Greg Snow
    Feb 1 '13 at 15:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.