# Estimating quantiles using quantile regression

I understand that quantile regression estimates the conditional quantile of some measured variable (call the variable $$y$$), but can you use quantile regression to estimate an unconditional quantile of a distribution? For example, if I had 100 data points

$$y_1,...,y_{100}\sim N(\mu, \sigma^2)$$

then I could use some method to try to estimate the true quantile of the distribution, i.e., $$q = \mu + z_\alpha\sigma$$. But if I don't have any covariate information, can I still use quantile regression to estimate some quantile of interest from my data $$y$$?

YES

This is just a quantile regression on an intercept and nothing else. The theory is similar to how OLS linear regression on just an intercept gives the mean.

Minimizing the sum of squared deviations gives the mean, and minimizing the sum of quantile loss values gives the quantile.

• thanks for confirming my suspicions. I know it's an estimate, but do you actually recover the true form of the quantile of the distribution using quantile regression in this case? For example, if I knew the true quantile of my distribution was $q=\mu+z_\alpha\sigma$, does the quantile estimate lead to that equation? Aug 10 at 19:27
• @JohnSmith No, you are not guaranteed to get the true value when you estimate from data.
– Dave
Aug 10 at 19:46
• Sorry, I need to learn to better state my questions. What I meant by recover the true form, is whether or not solving analytically the formula for the quantile regression gives you back the closed form solution for the quantile of the distribution of interest. So no data here but just maths. I'm attempting now to put pencil to paper by math skills is admittedly not that great Aug 10 at 20:09

Why not try it and see?

set.seed(1234)
library(quantreg)

x <- rnorm(1000)
m1 <- rq(x~1, c(0.1, 0.5, 0.9))
m1                            #-1.2121   -0.03965, 1.33418
quantile(x, c(0.1, 0.5, 0.9)) #-1.21322  -0.03979   1.3344


Interestingly, the estimates from quantile regression are not exactly the actual quantiles, although they are very close. I don't know why.

I also tried some other distributions, and some were a little less close than the one above.

• Note that the quantile function has nine methods of performing the calculation. This can be changed using the type argument.
– Dave
Aug 10 at 19:48
• Do you know how to get the quantreg function to give a confidence interval on the quantile estimate? Aug 10 at 20:31
• You can use boot.rq to get CIs. Aug 10 at 20:43
• Thanks. Might you be able to provide a simple example? Aug 10 at 20:46
• @JohnSmith Of possible interest
– Dave
Aug 11 at 8:07