Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

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


From   Prabhat <[email protected]>
To   [email protected]
Subject   Re: st: RE: plotting coefficients after quantile regression- beyond grqreg
Date   Tue, 9 Mar 2010 00:20:31 +0900

Sincere apologies. I was looking from totally wrong angle.
As of now, script suggested by Martin is enough for the task.

Thanks again.

Regards,
Prabhat Barnwal

On Mon, Mar 8, 2010 at 9:58 PM, Prabhat <[email protected]> wrote:

> Dear STATAlist and Martin,
>
> I think my prob requires separate scripting inside the loop. None of the
> options  seem to be helpful here. I am trying for last few hours but stil=
l
> clueless :(.
>
> Any help will be appreciated.
>
> Thanks.
>
> Regards,
> Prabhat
>
>
>
>
> On Mon, Mar 8, 2010 at 8:30 PM, Prabhat <[email protected]> wrote:
>
>> Thank you very much Martin.
>> It is very useful. However, I still need one more help. The average I wa=
nt
>> to use in the equation to predict the dependent variable (i.e. pred 10,
>> pred20...etc in this script), should be for those observations belonging=
 to
>> those quantile only.
>>
>> I mean, in the place of 'lengthmean', 'lengthmean 10', "lengthmean
>> 20"...etc are required for the corresponding quantile of dependent varia=
ble
>> i.e. price here.
>>
>> I tried to move egen inside the for loop, but I failed to figure out the
>> right way.
>>
>> Could you suggest a way out?
>>
>> Thanks again.
>>
>> Regards,
>> Prabhat
>> International University of Japan
>>
>>
>>
>> On Mon, Mar 8, 2010 at 3:10 AM, Martin Weiss <[email protected]>wrote=
:
>>
>>>
>>> <>
>>>
>>> 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 carefull=
y
>>> whether it does what you want:
>>>
>>> *******
>>> sysuse auto, clear
>>> gen mpgsq=3Dmpg^2
>>> egen lengthmean=3Dmean(length)
>>> egen turnmean=3Dmean(turn)
>>>
>>> foreach quant of numlist 10 25 50 75 90{
>>>        qreg price mpg mpgsq length turn, q(`quant')
>>>        gen pred`quant'=3D_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)
>>> *******
>>>
>>>
>>> HTH
>>> Martin
>>>
>>>
>>> -----Original Message-----
>>> From: [email protected]
>>> [mailto:[email protected]] On Behalf Of Prabhat
>>> Sent: Sonntag, 7. M=E4rz 2010 15:04
>>> To: [email protected]
>>> 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, m=
y
>>> requirement is to show the parabolic curve i.e. dependent variable vs X
>>> for
>>> quantile=3D 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 afte=
r
>>> getting the results. But, that seems to be a  difficult and tedious tas=
k
>>> because i have to repeat it for a number of cycles.
>>>
>>> Any suggestion will be highly appreciated.
>>>
>>> Thank you.
>>>
>>> Regards.
>>> Prabhat Barnwal
>>> International University of Japan
>>>
>>> *
>>> *   For searches and help try:
>>> *   http://www.stata.com/help.cgi?search
>>> *   http://www.stata.com/support/statalist/faq
>>> *   http://www.ats.ucla.edu/stat/stata/
>>>
>>>
>>> *
>>> *   For searches and help try:
>>> *   http://www.stata.com/help.cgi?search
>>> *   http://www.stata.com/support/statalist/faq
>>> *   http://www.ats.ucla.edu/stat/stata/
>>>
>>
>>
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index