Part of a series on |
Regression analysis |
---|
Models |
Estimation |
Background |
|
Quantile regression is a type of regression analysis used in statistics and econometrics. Whereas the method of least squares estimates the conditional mean of the response variable across values of the predictor variables, quantile regression estimates the conditional median (or other quantiles) of the response variable. Quantile regression is an extension of linear regression used when the conditions of linear regression are not met.
One advantage of quantile regression relative to ordinary least squares regression is that the quantile regression estimates are more robust against outliers in the response measurements. However, the main attraction of quantile regression goes beyond this and is advantageous when conditional quantile functions are of interest. Different measures of central tendency and statistical dispersion can be used to more comprehensively analyze the relationship between variables.[1]
In ecology, quantile regression has been proposed and used as a way to discover more useful predictive relationships between variables in cases where there is no relationship or only a weak relationship between the means of such variables. The need for and success of quantile regression in ecology has been attributed to the complexity of interactions between different factors leading to data with unequal variation of one variable for different ranges of another variable.[2]
Another application of quantile regression is in the areas of growth charts, where percentile curves are commonly used to screen for abnormal growth.[3][4]
The idea of estimating a median regression slope, a major theorem about minimizing sum of the absolute deviances and a geometrical algorithm for constructing median regression was proposed in 1760 by Ruđer Josip Bošković, a Jesuit Catholic priest from Dubrovnik.[1]:4[5] He was interested in the ellipticity of the earth, building on Isaac Newton's suggestion that its rotation could cause it to bulge at the equator with a corresponding flattening at the poles.[6] He finally produced the first geometric procedure for determining the equator of a rotating planet from three observations of a surface feature. More importantly for quantile regression, he was able to develop the first evidence of the least absolute criterion and preceded the least squares introduced by Legendre in 1805 by fifty years.[7]
Other thinkers began building upon Bošković's idea such as Pierre-Simon Laplace, who developed the so-called "methode de situation." This led to Francis Edgeworth's plural median[8] - a geometric approach to median regression - and is recognized as the precursor of the simplex method.[7] The works of Bošković, Laplace, and Edgeworth were recognized as a prelude to Roger Koenker's contributions to quantile regression.
Median regression computations for larger data sets are quite tedious compared to the least squares method, for which reason it has historically generated a lack of popularity among statisticians, until the widespread adoption of computers in the latter part of the 20th century.
Quantile regression expresses the conditional quantiles of a dependent variable as a linear function of the explanatory variables. Crucial to the practicality of quantile regression is that the quantiles can be expressed as the solution of a minimization problem, as we will show in this section before discussing conditional quantiles in the next section.
Let [math]\displaystyle{ Y }[/math] be a real-valued random variable with cumulative distribution function [math]\displaystyle{ F_{Y}(y)=P(Y\leq y) }[/math]. The [math]\displaystyle{ \tau }[/math]th quantile of Y is given by
where [math]\displaystyle{ \tau\in(0,1). }[/math]
Define the loss function as [math]\displaystyle{ \rho_{\tau}(m)=m(\tau-\mathbb{I}_{(m\lt 0)}) }[/math], where [math]\displaystyle{ \mathbb{I} }[/math] is an indicator function. A specific quantile can be found by minimizing the expected loss of [math]\displaystyle{ Y-u }[/math] with respect to [math]\displaystyle{ u }[/math]:[1](pp. 5–6):
This can be shown by computing the derivative of the expected loss with respect to [math]\displaystyle{ u }[/math] via an application of the Leibniz integral rule, setting it to 0, and letting [math]\displaystyle{ q_{\tau} }[/math] be the solution of
This equation reduces to
and then to
If the solution [math]\displaystyle{ q_{\tau} }[/math] is not unique, then we have to take the smallest such solution to obtain the [math]\displaystyle{ \tau }[/math]th quantile of the random variable Y.
Let [math]\displaystyle{ Y }[/math] be a discrete random variable that takes values [math]\displaystyle{ y_i = i }[/math] with [math]\displaystyle{ i = 1,2,\dots,9 }[/math] with equal probabilities. The task is to find the median of Y, and hence the value [math]\displaystyle{ \tau=0.5 }[/math] is chosen. Then the expected loss of [math]\displaystyle{ Y-u }[/math] is
Since [math]\displaystyle{ {0.5/9} }[/math] is a constant, it can be taken out of the expected loss function (this is only true if [math]\displaystyle{ \tau=0.5 }[/math]). Then, at u=3,
Suppose that u is increased by 1 unit. Then the expected loss will be changed by [math]\displaystyle{ (3)-(6)=-3 }[/math] on changing u to 4. If, u=5, the expected loss is
and any change in u will increase the expected loss. Thus u=5 is the median. The Table below shows the expected loss (divided by [math]\displaystyle{ {0.5/9} }[/math]) for different values of u.
u | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
Expected loss | 36 | 29 | 24 | 21 | 20 | 21 | 24 | 29 | 36 |
Consider [math]\displaystyle{ \tau=0.5 }[/math] and let q be an initial guess for [math]\displaystyle{ q_{\tau} }[/math]. The expected loss evaluated at q is
In order to minimize the expected loss, we move the value of q a little bit to see whether the expected loss will rise or fall. Suppose we increase q by 1 unit. Then the change of expected loss would be
The first term of the equation is [math]\displaystyle{ F_{Y}(q) }[/math] and second term of the equation is [math]\displaystyle{ 1-F_{Y}(q) }[/math]. Therefore, the change of expected loss function is negative if and only if [math]\displaystyle{ F_{Y}(q)\lt 0.5 }[/math], that is if and only if q is smaller than the median. Similarly, if we reduce q by 1 unit, the change of expected loss function is negative if and only if q is larger than the median.
In order to minimize the expected loss function, we would increase (decrease) L(q) if q is smaller (larger) than the median, until q reaches the median. The idea behind the minimization is to count the number of points (weighted with the density) that are larger or smaller than q and then move q to a point where q is larger than [math]\displaystyle{ 100\tau }[/math]% of the points.
The [math]\displaystyle{ \tau }[/math] sample quantile can be obtained by using an importance sampling estimate and solving the following minimization problem
where the function [math]\displaystyle{ \rho_{\tau} }[/math] is the tilted absolute value function. The intuition is the same as for the population quantile.
The [math]\displaystyle{ \tau }[/math]th conditional quantile of [math]\displaystyle{ Y }[/math] given [math]\displaystyle{ X }[/math] is the [math]\displaystyle{ \tau }[/math]th quantile of the Conditional probability distribution of [math]\displaystyle{ Y }[/math] given [math]\displaystyle{ X }[/math],
We use a capital [math]\displaystyle{ Q }[/math] to denote the conditional quantile to indicate that it is a random variable.
In quantile regression for the [math]\displaystyle{ \tau }[/math]th quantile we make the assumption that the [math]\displaystyle{ \tau }[/math]th conditional quantile is given as a linear function of the explanatory variables:
Given the distribution function of [math]\displaystyle{ Y }[/math], [math]\displaystyle{ \beta_{\tau} }[/math] can be obtained by solving
Solving the sample analog gives the estimator of [math]\displaystyle{ \beta }[/math].
Note that when [math]\displaystyle{ \tau = 0.5 }[/math], the loss function [math]\displaystyle{ \rho_\tau }[/math] is proportional to the absolute value function, and thus median regression is the same as linear regression by least absolute deviations.
The mathematical forms arising from quantile regression are distinct from those arising in the method of least squares. The method of least squares leads to a consideration of problems in an inner product space, involving projection onto subspaces, and thus the problem of minimizing the squared errors can be reduced to a problem in numerical linear algebra. Quantile regression does not have this structure, and instead the minimization problem can be reformulated as a linear programming problem
where
Simplex methods[1]:181 or interior point methods[1]:190 can be applied to solve the linear programming problem.
For [math]\displaystyle{ \tau\in(0,1) }[/math], under some regularity conditions, [math]\displaystyle{ \hat{\beta}_{\tau} }[/math] is asymptotically normal:
where
Direct estimation of the asymptotic variance-covariance matrix is not always satisfactory. Inference for quantile regression parameters can be made with the regression rank-score tests or with the bootstrap methods.[9]
See invariant estimator for background on invariance or see equivariance.
For any [math]\displaystyle{ a\gt 0 }[/math] and [math]\displaystyle{ \tau\in[0,1] }[/math]
For any [math]\displaystyle{ \gamma\in R^{k} }[/math] and [math]\displaystyle{ \tau\in[0,1] }[/math]
Let [math]\displaystyle{ A }[/math] be any [math]\displaystyle{ p\times p }[/math] nonsingular matrix and [math]\displaystyle{ \tau\in[0,1] }[/math]
If [math]\displaystyle{ h }[/math] is a nondecreasing function on [math]\displaystyle{ \mathbb{R} }[/math], the following invariance property applies:
Example (1):
If [math]\displaystyle{ W=\exp(Y) }[/math] and [math]\displaystyle{ Q_{Y|X}(\tau)=X\beta_{\tau} }[/math], then [math]\displaystyle{ Q_{W|X}(\tau)=\exp(X\beta_{\tau}) }[/math]. The mean regression does not have the same property since [math]\displaystyle{ \operatorname{E} (\ln(Y))\neq \ln(\operatorname{E}(Y)). }[/math]
The linear model [math]\displaystyle{ Q_{Y|X}(\tau)=X\beta_{\tau} }[/math] mis-specifies the true systematic relation [math]\displaystyle{ Q_{Y|X}(\tau)=f(X,\tau) }[/math] when [math]\displaystyle{ f(\cdot,\tau) }[/math] is nonlinear. However, [math]\displaystyle{ Q_{Y|X}(\tau)=X\beta_{\tau} }[/math] minimizes a weighted distanced to [math]\displaystyle{ f(X,\tau) }[/math] among linear models.[10] Furthermore, the slope parameters [math]\displaystyle{ \beta_{\tau} }[/math] of the linear model can be interpreted as weighted averages of the derivatives [math]\displaystyle{ \nabla f(X,\tau) }[/math] so that [math]\displaystyle{ \beta_{\tau} }[/math] can be used for causal inference.[11] Specifically, the hypothesis [math]\displaystyle{ H_0: \nabla f(x,\tau)=0 }[/math] for all [math]\displaystyle{ x }[/math] implies the hypothesis [math]\displaystyle{ H_0: \beta_\tau=0 }[/math], which can be tested using the estimator [math]\displaystyle{ \hat{\beta_{\tau}} }[/math] and its limit distribution.
The goodness of fit for quantile regression for the [math]\displaystyle{ \tau }[/math] quantile can be defined as:[12] [math]\displaystyle{ R^2(\tau)=1-\frac{\hat{V}_\tau}{\tilde{V}_\tau}, }[/math] where [math]\displaystyle{ \hat{V}_\tau }[/math] is the sum of squares of the conditional quantile, while [math]\displaystyle{ \tilde{V}_\tau }[/math] is the sum of squares of the unconditional quantile.
Because quantile regression does not normally assume a parametric likelihood for the conditional distributions of Y|X, the Bayesian methods work with a working likelihood. A convenient choice is the asymmetric Laplacian likelihood,[13] because the mode of the resulting posterior under a flat prior is the usual quantile regression estimates. The posterior inference, however, must be interpreted with care. Yang, Wang and He[14] provided a posterior variance adjustment for valid inference. In addition, Yang and He[15] showed that one can have asymptotically valid posterior inference if the working likelihood is chosen to be the empirical likelihood.
Beyond simple linear regression, there are several machine learning methods that can be extended to quantile regression. A switch from the squared error to the tilted absolute value loss function (a.k.a. the pinball loss[16]) allows gradient descent-based learning algorithms to learn a specified quantile instead of the mean. It means that we can apply all neural network and deep learning algorithms to quantile regression,[17][18] which is then referred to as nonparametric quantile regression.[19] Tree-based learning algorithms are also available for quantile regression (see, e.g., Quantile Regression Forests,[20] as a simple generalization of Random Forests).
If the response variable is subject to censoring, the conditional mean is not identifiable without additional distributional assumptions, but the conditional quantile is often identifiable. For recent work on censored quantile regression, see: Portnoy[21] and Wang and Wang[22]
Example (2):
Let [math]\displaystyle{ Y^{c}=\max(0,Y) }[/math] and [math]\displaystyle{ Q_{Y|X}=X\beta_{\tau} }[/math]. Then [math]\displaystyle{ Q_{Y^{c}|X}(\tau)=\max(0,X\beta_{\tau}) }[/math]. This is the censored quantile regression model: estimated values can be obtained without making any distributional assumptions, but at the cost of computational difficulty,[23] some of which can be avoided by using a simple three step censored quantile regression procedure as an approximation.[24]
For random censoring on the response variables, the censored quantile regression of Portnoy (2003)[21] provides consistent estimates of all identifiable quantile functions based on reweighting each censored point appropriately.
Censored quantile regression has close links to survival analysis.
The quantile regression loss needs to be adapted in the presence of heteroscedastic errors in order to be efficient.[25]
Numerous statistical software packages include implementations of quantile regression:
quantreg
[26]quantreg
command.[27]quantreg
by Roger Koenker,[28] but also gbm
,[29] quantregForest
,[30] qrnn
[31] and qgam
[32]Scikit-garden
[33] and statsmodels
[34]proc quantreg
(ver. 9.2)[35] and proc quantselect
(ver. 9.3).[36]qreg
command.[37][38]--loss_function quantile
.[39]QuantileRegression.m
[40] hosted at the MathematicaForPrediction project at GitHub.QuantileRegression
[41] hosted at Wolfram Function Repository.The Wikibook R Programming has a page on the topic of: Quantile Regression |
Original source: https://en.wikipedia.org/wiki/Quantile regression.
Read more |