------------------------------------------------------------------------------- help for

grqregJoao Pedro Azevedo Last update: 17 March 2011 version: 2.1 -------------------------------------------------------------------------------

Graph the coefficients of aQuantile Regression

grqreg[varlist] [weight] [,qmin(integer)qmax(integer)qstep(integer)quantiles(#[#[# ...]])level(confidenceinterval)title(title list)mfx(type)consciolsolscicomparelistformat(%fmt)seed(integer)reps(integer)save(filename)]

fweightsandaweightsare allowed afterqreg; see help weights. See help weight.

Description

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

grqregrewards 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 availablegrqreguses the variable names.

grqregworks afterqreg,bsqregandsqreg.

grqregis an rclass program.

Options

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

qminsets the minimum value for the quantile. Default value .05.

qmaxsets the maximum value for the quantile. Default value .95.

qstepsets the quantile increments. Default value .05.

quantileestimate # quantiles; this is a default option after runningsqreg. 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).

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

consplots the intercept. Default off.

cigraph confidence interval of Quantile Regression. Default off.

olsgraph OLS estimate. Default off.

list

olscigraph OLS confidence interval of the OLS regression. Default off.

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

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

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

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

dydxspecifies that marginal effects be calculated. It is the default.

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

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

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

Standard Errors

grqreguses 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 Formulasfrom 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.

RemarksFor extreme quantiles it is not recomended to push tau (

qstep) into the tails (qminandqmax) 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

ReferencesChernozhukov, 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 ofEconomic Perspectives, 15(4): 143-156.Koenker, R. and Geling, O. (2001) Reappraising medfly longevity: a quantile regression survival analysis.

Journal of the AmericanStatistical Association, 96: 458-468.Rogers, W. H. (1993) "Calculation of quantile regression standard errors."

Stata Technical Bulltin, 3: 77-78.

AuthorJoao Pedro Azevedo jazevedo@worldbank.org

AknowledgementsThis 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 seeManual:

[R] qreg bsqreg sqreg mfxOnline: help for qreg bsqreg sqreg mfx