# Quantile regression with one predictor

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

Motivation
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.

## 1 Answer

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).

• Is there a relation that median regression goes through at least k+1 points? K is number of parameters without constant. Feb 1 '13 at 8:15
• 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. Feb 1 '13 at 15:43