Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: plotting coefficients after quantile regression- beyond grqreg

From   "Martin Weiss" <>
To   <>
Subject   st: RE: plotting coefficients after quantile regression- beyond grqreg
Date   Sun, 7 Mar 2010 19:10:23 +0100


The difficulty here is that -qreg- does not seem to like -fvvarlist-s, which
in other cases make quadratic vars much easier to specify (It does not allow
-coeflegend-, either...). So you want to check this very, very carefully
whether it does what you want:

sysuse auto, clear
gen mpgsq=mpg^2
egen lengthmean=mean(length)
egen turnmean=mean(turn)

foreach quant of numlist 10 25 50 75 90{
	qreg price mpg mpgsq length turn, q(`quant')
	gen pred`quant'=_b[_cons]+_b[mpg]*mpg+_b[mpgsq]*mpgsq+ /* 
	 */ _b[length]*lengthmean+_b[turn]*turnmean
	la var pred`quant' "Quantile `quant'"

sort mpg

tw (line pred10 mpg)  /* 
 */ (line pred25 mpg) (line pred50 mpg)  /* 
 */ (line pred75 mpg) (line pred90 mpg)


-----Original Message-----
[] On Behalf Of Prabhat
Sent: Sonntag, 7. März 2010 15:04
Subject: st: plotting coefficients after quantile regression- beyond grqreg

Dear all,

I need your help regarding plots for quantile regression  results. I am new
to STATA as well as quantile regression both.

I am running a quantile regression with independent variable X and its
square term i.e. X^2. there are a number of other variables. however, my
requirement is to show the parabolic curve i.e. dependent variable vs X for
quantile= 0.1,0.25, 0.5, 0.75, 0.9,  keeping all other explanatory variables
at their average value. So, it will be kind of a 5 parabolic curves on a
single plot.

I know there is a very helpful command GRQREG, but it does not plot the
particular estimated coefficients for a number of quantiles on the same
plot. Kindly correct me, if there is any way here.

Further, the only other option I can think of if to do it manually after
getting the results. But, that seems to be a  difficult and tedious task
because i have to repeat it for a number of cycles.

Any suggestion will be highly appreciated.

Thank you.

Prabhat Barnwal
International University of Japan

*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index