Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: Adding data-driven reference line to quantile plot


From   "Eric G. Wruck" <[email protected]>
To   [email protected]
Subject   Re: st: RE: Adding data-driven reference line to quantile plot
Date   Thu, 26 May 2005 23:53:33 -0400

Thanks, Nick.  Looks like a very useful approach.

Eric


>Suppose you work out that the company in
>question is the 42nd observation.
>
>Then the option could be
>
>yline(`=ret2001Q2[42]')
>
>Suppose you are cycling over several
>variables. You can still use the same idea:
>
>foreach v of var <whatever> {
>	quantile `v', recast(line) rlopts(lwidth(medthick)) ///
>	ylabel(-.06 (.01) .06, ang(h)) yline(`=`v'[42]')    ///
>	xlabel(0 .1 .2 .25 .3 .4 .5 .6 .7  .75 .8 .9 1)     ///
>	xline(0 .1 .2 .25 .3 .4 .5 .6 .7 .75 .8 .9 1, lcolor(bluishgray))
>}
>
>What you are relying on here is that -quantile- does not
>(permanently) affect the sort order of the data.
>
>Nick
>[email protected]
>
>Eric G. Wruck
> 
>> I am generating a series of quantile plots of quarterly returns but
>> would like to flag one company (out of 150 or so that comprise the
>> data).  I found one way of doing this, using yline after manually
>> looking up that company's value for the quarter in question.  For
>> example,
>>
>> quantile ret2001Q2, recast(line) rlopts(lwidth(medthick)) ylabel(-.06
>> (.01) .06, angle(horizontal)) yline(0.011) xlabel(0 .1 .2 .25 .3 .4
>> .5 .6 .7  .75 .8 .9 1) xline(0 .1 .2 .25 .3 .4 .5 .6 .7 .75 .8 .9 1,
>> lcolor(bluishgray))
>>
>> Here I looked up the 2001, 2nd quarter return for the company in
>> question & saw that its return was 0.011 -- hence, yline(0.011).
>>
>> My question is: is there a way to pass something to yline from the
>> data so that this doesn't have to be a manual operation (& hence
>> susceptible to error)?
>
>*
>*   For searches and help try:
>*   http://www.stata.com/support/faqs/res/findit.html
>*   http://www.stata.com/support/statalist/faq
>*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index