http://www.stata.com/capabilities/qreg.html
Quantile regression
- including median, minimization of sums of absolute deviations
- Koenker and Bassett or bootstrapped standard errors
Stata's qreg command fits quantile (including median) regression models, also known as least-absolute value (LAV) models, minimum absolute deviation (MAD) models, and L1-norm models.
Median regression estimates the median of the dependent variable, conditional on the values of the independent variable. This is similar to least-squares regression, which estimates the mean of the dependent variable. Said differently, median regression finds the regression plane that minimizes the sum of the absolute residuals rather than the sum of the squared residuals.
. qreg ln_wage edyrs exp exp_sq Iteration 1: sum of abs. weighted deviations = 18804.696 Iteration 2: sum of abs. weighted deviations = 18607.296 (output omitted) Iteration 25: sum of abs. weighted deviations = 18229.301 Median regression Number of obs = 29650 Raw sum of deviations 22631.6 (about 9.95228) Min sum of deviations 18229.3 Pseudo R2 = 0.1945 --------------------------------------------------------------------------- ln_wage | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---------+----------------------------------------------------------------- edyrs | .1282041 .0012835 99.883 0.000 .1256883 .1307199 exp | .0942597 .0010175 92.637 0.000 .0922653 .0962541 exp_sq | -.0015612 .0000231 -67.631 0.000 -.0016065 -.001516 _cons | 7.356049 .0182586 402.882 0.000 7.320262 7.391837 ---------------------------------------------------------------------------
This example uses 1991 CPS data for males aged 17 to 64. The syntax for all estimation commands is the same: after the command name, the name of the dependent variable is followed by the names of the independent variables. By default, qreg performs median regression — the estimates above were obtained by minimizing the sums of the absolute residuals.
By comparison, the results from least-squares regression are
. regress ln_wage edyrs exp exp_sq Source | SS df MS Number of obs = 29650 ---------+------------------------------ F( 3, 29646) = 4742.53 Model | 11309.4187 3 3769.80624 Prob > F = 0.0000 Residual | 23565.4268 29646 .794893977 R-squared = 0.3243 ---------+------------------------------ Adj R-squared = 0.3242 Total | 34874.8456 29649 1.17625706 Root MSE = .89157 --------------------------------------------------------------------------- ln_wage | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---------+----------------------------------------------------------------- edyrs | .1334425 .0018387 72.576 0.000 .1298386 .1370463 exp | .111906 .0014589 76.705 0.000 .1090465 .1147655 exp_sq | -.0018887 .0000331 -57.081 0.000 -.0019536 -.0018239 _cons | 6.949451 .026166 265.591 0.000 6.898164 7.000737 ---------------------------------------------------------------------------
qreg can also estimate the regression plane for quantiles other than the 0.5 (median). For instance, the following model describes the 90th percentile (.9 quantile) of ln_wage:
. qreg ln_wage edyrs exp exp_sq, quantile(.90) Iteration 1: sum of abs. weighted deviations = 9141.9044 Iteration 2: sum of abs. weighted deviations = 8500.0497 (output omitted) Iteration 22: sum of abs. weighted deviations = 6417.128 .9 Quantile regression Number of obs = 29650 Raw sum of deviations 8027.156 (about 10.8198) Min sum of deviations 6417.128 Pseudo R2 = 0.2006 --------------------------------------------------------------------------- ln_wage | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---------+----------------------------------------------------------------- edyrs | .1126145 .0020545 54.814 0.000 .1085877 .1166414 exp | .064232 .0013707 46.861 0.000 .0615454 .0669186 exp_sq | -.0009451 .0000335 -28.192 0.000 -.0010108 -.0008793 _cons | 8.475585 .027091 312.856 0.000 8.422485 8.528685 ---------------------------------------------------------------------------
The following regression describes the 10th percentile (.1 quantile):
. qreg ln_wage edyrs exp exp_sq, quantile(.10) Iteration 1: sum of abs. weighted deviations = 12445.284 Iteration 2: sum of abs. weighted deviations = 11883.493 (output omitted) Iteration 14: sum of abs. weighted deviations = 11440.085 .1 Quantile regression Number of obs = 29650 Raw sum of deviations 14503.39 (about 8.3894) Min sum of deviations 11440.09 Pseudo R2 = 0.2112 ---------------------------------------------------------------------------- ln_wage | Coef. Std. Err. t P>|t| [95% Conf. Interval] ---------+----------------------------------------------------------------- edyrs | .1621845 .0055457 29.245 0.000 .1513147 .1730543 exp | .1754884 .0044497 39.438 0.000 .1667668 .18421 exp_sq | -.0033157 .0000956 -34.700 0.000 -.003503 -.0031284 _cons | 5.049422 .0864032 58.440 0.000 4.880068 5.218776 ----------------------------------------------------------------------------
Interpreting the results, ln_wage is the log of wage-and-salary earnings, edyrs is the years of schooling completed, and exp is potential labor-force experience, defined as age minus schooling minus 6. exp_sq is the square of exp.
The regressions indicate that the effect of schooling is more pronounced at the first decile of earnings than at the ninth decile. In models of this kind, the coefficient on edyrs can be thought of as the "return on additional schooling". At the ninth decile, the return is 11%, while at the first, it is 16%. Economy-wide increases in schooling, therefore, would decrease the gap between the first and ninth deciles in log earnings.
References
- Gould, W. 1992.
- sg11.1: Quantile regression with bootstrapped standard errors. Stata Technical Bulletin 9: 19–21. Reprinted in Stata Technical Bulletin Reprints, vol. 2, pp. 137–150.
- Gould, W. and W. H. Rogers. 1994.
- Quantile regression as an alternative to robust regression. Proceedings of the Statistical Computing Section. Alexandria, VA: American Statistical Association.
- Rogers, W. H. 1992.
- sg11: Quantile regression standard errors. Stata Technical Bulletin 9: 16–19. Reprinted in Stata Technical Bulletin Reprints, vol. 2, pp. 133–137.
- ------. 1993.
- sg11.2: Calculation of quantile regression standard errors. Stata Technical Bulletin 13: 18–19. Reprinted in Stata Technical Bulletin, vol. 3, pp. 77–78.