------------------------------------------------------------------------------- help for grqreg Joao Pedro Azevedo Last update: 17 March 2011 version: 2.1 -------------------------------------------------------------------------------

Graph the coefficients of a Quantile Regression

grqreg [varlist] [weight] [, qmin(integer) qmax(integer) qstep(integer) quantiles(#[#[# ...]]) level(confidence interval) title(title list) mfx(type) cons ci ols olsci compare list format(%fmt) seed(integer) reps(integer) save(filename)]

fweights and aweights are allowed after qreg; see help weights. See help weight.

Description

grqreg graphs the coefficients of a quantile regression (Koenker and Basset, 1978). It also has the option to graph the confidence interval, the OLS coefficient and the OLS confidence interval on the same graph.

grqreg rewards the use of variable labels. The variable labels are used in the graphs, providing more intelligible variable descriptions than 8-letter names. If no variable label is available grqreg uses the variable names.

grqreg works after qreg, bsqreg and sqreg.

grqreg is an rclass program.

Options

varlist Select variables that will be graphed. Default value are all the estimated coefficients except the intercept.

qmin sets the minimum value for the quantile. Default value .05.

qmax sets the maximum value for the quantile. Default value .95.

qstep sets the quantile increments. Default value .05.

quantile estimate # quantiles; this is a default option after running sqreg. When using this option please use the same number format for all quantiles (i.e. .25 .50 .75 or .251 .503 .752) and not (05 515 750).

level sets the level of the confidence interval. Default value the same used in the original regression.

cons plots the intercept. Default off.

ci graph confidence interval of Quantile Regression. Default off.

ols graph OLS estimate. Default off.

list

olsci graph OLS confidence interval of the OLS regression. Default off.

compare graphs two coefficients of a quantile regression. Only supports two variables at the time. The first variable is ploted on the y-axis and the second variable on the x-axis. Default off.

title Allow user to assing individual title names for each one of the figures. Please note that no spaces are allowed between the name of the same figure (i.e. Fig1a Fig1b ... Fig1z).

seed(integer). Set seed value.

reps(integer). Default value 20.

format(%fmt). Default value %9.2f. For more information please see format.

save Allow user to create a new dataset with the point estimates used to generate the graphs. The replace option is permanently enabled.

mfx: Options (the mfx option is not supported after the sqreg command){p_end}

dydx specifies that marginal effects be calculated. It is the default.

eyex specifies that elasticities be calculated in the form d(lny)/d(lnx)

dyex specifies that elasticities be calculated in the form d(y)/d(lnx)

eydx specifies that elasticities be calculated in the form d(lny)/d(x)

Standard Errors

grqreg uses the standard errors generated by the qreg, bsqreg and sqreg commands.

qreg estimates the variance-covariance matrix of coefficients using a method of Kroenker and Basset (1982) and Rogers (1993). This is described in Methods and Formulas from the Stata Manual.

sqreg obtains an estiamte of the variance-covariance matrix via bootstraping and the variance-covariance matrix includes between quantile blocks.

bsqreg obtains an estiamte of the variance-covariance matrix via bootstraping with one quantile.

Please notice that: -bsqreg- and -sqreg- have different standard errors (same initial seed and quantile) because the two commands use different methods to generate bootstrap sample.

Both commands calculate the bootstrap standard errors manually instead of using the official -bootstrap- prefix command. The -bsqreg- command uses -bsample- to take each of the bootstrap samples. You can type

help bsample

for details on this command. On the other hand, -sqreg- uses the undocumented -bsampl_w- command. You can type

viewsource bsampl_w.ado

to see the code and more information on this command. Here, you will see that this is logically equivalent to -bsample-, but because they use different algorithms, they will not create the same bootstrap sample when used with the same seed.

Remarks

For extreme quantiles it is not recomended to push tau (qstep) into the tails (qmin and qmax) too far especially when there are a large number of parameters being estimated.

The crucial element is the existence of enough observations above and below to make it plausible that the fit isn't just an artifact of a few extreme observations.

The asymptotics rely on there being enough observations on both sides in order to get a conditional central limit theorem (CLT) effect from the gradient. A rough rule of thumb would be that min{n tau , n(1-tau)} should be 10p where p is the number of parameters being estimated. So if you have p = 5, n=5000 then tau shouldn't be smaller than .01.

For more details on this remark please refer to Koenker and Eboil (2001) and Chernozhukov (2000).

Examples

. webuse auto, clear . xi: qreg price mpg i.foreign*i.rep78 headroom . grqreg, cons ci ols olsci

. qreg price mpg headroom . grqreg, cons ci ols olsci title(Fig.1a Fig.1b Fig.1c)

. bsqreg price mpg headroom, reps(100) . grqreg, cons ci ols olsci title(Fig.1a Fig.1b Fig.1c)

. sqreg price weight length foreign, quantile(.25 .5 .75) reps(100) . grqreg, ci ols olsci title(Fig.1a Fig.1b Fig.1c)

. sqreg price weight length foreign, quantile(.2 .4 .6 .8) reps(100) . grqreg, cons

. qreg price mpg trunk weight length . grqreg weight length, compare

References

Chernozhukov, V. (2000) Conditional Extremes and Near-Extremes. MIT Dept. of Economics Working Paper No. 01-21. http://ssrn.com/abstract=272836

Koenker, R. and G. Basset (1978) "Regression Quantiles." Econometrica, 46(1): 33-50.

Koenker, R. and G. Basset (1982) "Robust test for heteroscedasticity based on regression quantiles." Econometrica, 50(1): 43-61.

Koenker, R. and K. F. Hallock (2001) "Quantile Regression." Journal of Economic Perspectives, 15(4): 143-156.

Koenker, R. and Geling, O. (2001) Reappraising medfly longevity: a quantile regression survival analysis. Journal of the American Statistical Association , 96: 458-468.

Rogers, W. H. (1993) "Calculation of quantile regression standard errors." Stata Technical Bulltin, 3: 77-78.

Author

Joao Pedro Azevedo jazevedo@worldbank.org

Aknowledgements

This ado uses part of the code written by Michael Blasnik (qregtrace). I would also like to thank Jeffrey T Grogger, Scott Merryman, Martin Weiss, Getúlio Borges, James Hassell and Nick Cox for their valuable suggestions. Many thanks to Joy Wang for the clarifications regarding the bootstrap procedures of bsqreg and sqreg. The usual disclaimer applies.

Also see

Manual: [R] qreg bsqreg sqreg mfx Online: help for qreg bsqreg sqreg mfx