{smcl} {* 17 March 2011} {hline} help for {cmd:grqreg}{right:Joao Pedro Azevedo} {right:Last update: 17 March 2011} {right:version: 2.1} {hline} {title:Graph the coefficients of a {cmd:Quantile Regression}} {p 8 21 2}{cmdab:grqreg} [{it:varlist}] [{help weight}] [{cmd:,} {cmdab:qmin}{cmd:(}{it:integer}{cmd:)} {cmdab:qmax}{cmd:(}{it:integer}{cmd:)} {cmdab:qstep}{cmd:(}{it:integer}{cmd:)} {cmdab:quantiles}{cmd:(}#[#[# ...]]{cmd:)} {cmdab:level}{cmd:(}{it:confidence interval}{cmd:)} {cmdab:title}{cmd:(}{it:title list}{cmd:)} {cmdab:mfx}{cmd:(}{it:type}{cmd:)} {cmd:cons} {cmd:ci} {cmd:ols} {cmd:olsci} {cmd:compare} {cmd:list} {cmdab:format}{cmd:(}{it:%fmt}{cmd:)} {cmdab:seed}{cmd:(}{it:integer}{cmd:)} {cmdab:reps}{cmd:(}{it:integer}{cmd:)} {cmdab:save}{cmd:(}{it:filename}{cmd:)}] {p 4 4 2}{cmd:fweights} and {cmd:aweights} are allowed after {cmd:qreg}; see help weights. See help {help weight}.{p_end} {title:Description} {p 4 4 2}{cmd: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.{p_end} {p 4 4 2}{cmd: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 {cmd:grqreg} uses the variable names.{p_end} {p 4 4 2}{cmd:grqreg} works after {cmd:qreg}, {cmd:bsqreg} and {cmd:sqreg}.{p_end} {p 4 4 2}{cmd:grqreg} is an rclass program.{p_end} {title:Options} {p 4 4 2}{cmdab:varlist} Select variables that will be graphed. Default value are all the estimated coefficients except the intercept.{p_end} {p 4 4 2}{cmdab:qmin} sets the minimum value for the quantile. Default value .05.{p_end} {p 4 4 2}{cmdab:qmax} sets the maximum value for the quantile. Default value .95.{p_end} {p 4 4 2}{cmdab:qstep} sets the quantile increments. Default value .05.{p_end} {p 4 4 2}{cmdab:quantile} estimate # quantiles; this is a default option after running {cmd: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).{p_end} {p 4 4 2}{cmdab:level} sets the level of the confidence interval. Default value the same used in the original regression.{p_end} {p 4 4 2}{cmd:cons} plots the intercept. Default off.{p_end} {p 4 4 2}{cmd:ci} graph confidence interval of Quantile Regression. Default off.{p_end} {p 4 4 2}{cmd:ols} graph OLS estimate. Default off.{p_end} {p 4 4 2}{cmd:list}{p_end} {p 4 4 2}{cmd:olsci} graph OLS confidence interval of the OLS regression. Default off.{p_end} {p 4 4 2}{cmd: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.{p_end} {p 4 4 2}{cmd: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). {p_end} {p 4 4 2}{cmdab:seed}{cmd:(}{it:integer}{cmd:)}. Set seed value.{p_end} {p 4 4 2}{cmdab:reps}{cmd:(}{it:integer}{cmd:)}. Default value 20.{p_end} {p 4 4 2}{cmdab:format}{cmd:(}{it:%fmt}{cmd:)}. Default value %9.2f. For more information please see {help format}.{p_end} {p 4 4 2}{cmd:save} Allow user to create a new dataset with the point estimates used to generate the graphs. The replace option is permanently enabled.{p_end} {title:mfx}: Options (the mfx option is not supported after the sqreg command){p_end} {p 4 4 2}{cmd:dydx} specifies that marginal effects be calculated. It is the default.{p_end} {p 4 4 2}{cmd:eyex} specifies that elasticities be calculated in the form d(lny)/d(lnx){p_end} {p 4 4 2}{cmd:dyex} specifies that elasticities be calculated in the form d(y)/d(lnx){p_end} {p 4 4 2}{cmd:eydx} specifies that elasticities be calculated in the form d(lny)/d(x){p_end} {title:Standard Errors} {p 4 4 2}{cmd:grqreg} uses the standard errors generated by the {help qreg}, {help bsqreg} and {help sqreg} commands.{p_end} {p 4 4 2}{help qreg} estimates the variance-covariance matrix of coefficients using a method of Kroenker and Basset (1982) and Rogers (1993). This is described in {it:Methods and Formulas} from the Stata Manual.{p_end} {p 4 4 2}{help sqreg} obtains an estiamte of the variance-covariance matrix via bootstraping and the variance-covariance matrix includes between quantile blocks.{p_end} {p 4 4 2}{help bsqreg} obtains an estiamte of the variance-covariance matrix via bootstraping with one quantile.{p_end} {p 4 4 2}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.{p_end} {p 4 4 2}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{p_end} {p 8 4 2}{stata "help bsample"}{p_end} {p 4 4 2}for details on this command. On the other hand, -sqreg- uses the undocumented -bsampl_w- command. You can type{p_end} {p 8 4 2}{stata "viewsource bsampl_w.ado"}{p_end} {p 4 4 2}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.{p_end} {title:Remarks} {p 4 4 2} For extreme quantiles it is not recomended to push tau ({cmdab:qstep}) into the tails ({cmdab:qmin} and {cmdab:qmax}) too far especially when there are a large number of parameters being estimated.{p_end} {p 4 4 2} 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.{p_end} {p 4 4 2} 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.{p_end} {p 4 4 2} For more details on this remark please refer to Koenker and Eboil (2001) and Chernozhukov (2000).{p_end} {title:Examples} {p 4 8}{stata "webuse auto, clear" :. webuse auto, clear}{p_end} {p 4 8}{stata "xi: qreg price mpg i.foreign*i.rep78 headroom" :. xi: qreg price mpg i.foreign*i.rep78 headroom}{p_end} {p 4 8}{stata "grqreg, cons ci ols olsci" :. grqreg, cons ci ols olsci}{p_end} {p 4 8}{stata "qreg price mpg headroom" :. qreg price mpg headroom}{p_end} {p 4 8}{stata "grqreg, cons ci ols olsci title(Fig.1a Fig.1b Fig.1c)" :. grqreg, cons ci ols olsci title(Fig.1a Fig.1b Fig.1c)}{p_end} {p 4 8}{stata "bsqreg price mpg headroom, reps(100)" :. bsqreg price mpg headroom, reps(100)}{p_end} {p 4 8}{stata "grqreg, cons ci ols olsci title(Fig.1a Fig.1b Fig.1c)" :. grqreg, cons ci ols olsci title(Fig.1a Fig.1b Fig.1c)}{p_end} {p 4 8}{stata "sqreg price weight length foreign, quantile(.25 .5 .75) reps(100)" :. sqreg price weight length foreign, quantile(.25 .5 .75) reps(100)}{p_end} {p 4 8}{stata "grqreg, ci ols olsci title(Fig.1a Fig.1b Fig.1c)" :. grqreg, ci ols olsci title(Fig.1a Fig.1b Fig.1c)}{p_end} {p 4 8}{stata "sqreg price weight length foreign, quantile(.2 .4 .6 .8) reps(100)" :. sqreg price weight length foreign, quantile(.2 .4 .6 .8) reps(100)}{p_end} {p 4 8}{stata "grqreg, cons" :. grqreg, cons}{p_end} {p 4 8}{stata "qreg price mpg trunk weight length" :. qreg price mpg trunk weight length}{p_end} {p 4 8}{stata "grqreg weight length, compare" :. grqreg weight length, compare}{p_end} {title:References} {p 4 8 2}Chernozhukov, V. (2000) Conditional Extremes and Near-Extremes. MIT Dept. of Economics Working Paper No. 01-21. {browse "http://ssrn.com/abstract=272836"} {p 4 8 2}Koenker, R. and G. Basset (1978) "Regression Quantiles." {it:Econometrica}, 46(1): 33-50.{p_end} {p 4 8 2}Koenker, R. and G. Basset (1982) "Robust test for heteroscedasticity based on regression quantiles." {it:Econometrica}, 50(1): 43-61.{p_end} {p 4 8 2}Koenker, R. and K. F. Hallock (2001) "Quantile Regression." {it:Journal of Economic Perspectives}, 15(4): 143-156.{p_end} {p 4 8 2}Koenker, R. and Geling, O. (2001) Reappraising medfly longevity: a quantile regression survival analysis. {it:Journal of the American Statistical Association }, 96: 458-468.{p_end} {p 4 8 2}Rogers, W. H. (1993) "Calculation of quantile regression standard errors." {it:Stata Technical Bulltin}, 3: 77-78.{p_end} {title:Author} Joao Pedro Azevedo jazevedo@worldbank.org {title:Aknowledgements} {p 4 4 2}This ado uses part of the code written by Michael Blasnik (qregtrace).{p_end} {p 4 4 2}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.{p_end} {p 4 4 2}Many thanks to Joy Wang for the clarifications regarding the bootstrap procedures of bsqreg and sqreg.{p_end} {p 4 4 2}The usual disclaimer applies.{p_end} {title:Also see} {p 4 13 2}Manual: {hi:[R] qreg bsqreg sqreg mfx}{p_end} {p 4 13 2}Online: help for {help qreg} {help bsqreg} {help sqreg} {help mfx}{p_end}