Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Re: percentages (p75)


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: Re: percentages (p75)
Date   Sat, 19 May 2007 07:50:32 +0100 (BST)

Yes, and the principle is pretty much the same in the example I sent
earlier:
*-------------- begin example --------------
sysuse nlsw88, clear
xtile quintile = wage, nquantiles(5)

twoway kdensity tenure if quintile==1 || /*
   */  kdensity tenure if quintile==2 || /*
   */  kdensity tenure if quintile==3 || /*
   */  kdensity tenure if quintile==4 || /*
   */  kdensity tenure if quintile==5 
*-------------- end example ----------------
(For more on how to use examples I sent to the Statalist, see:
http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html )


--- [email protected] wrote:
> Is there a way to do a fiveway kdensity smoother, similar to below
> but with 5 differently colored lines?

> > --- [email protected] wrote:
> > > Do you know how to take the "liberals" and view a histogram of
> > > only their income, and then superimpose it on the general
> > > population income?

> --- Maarten Buis wrote:
> > Histograms aren't really well suited for this, have a look at
> > -kdensity- like in the extension of the example I sent earlier:
> >
> > *-------------- begin example --------------
> > sysuse nlsw88, clear
> > sum tenure, detail
> > local top25 = r(p75)
> > replace wage = -wage /*just to make sure the
> > top 25 % of tenure measures something similar
> > to the bottom 25% of wage, you shouldn't do
> > this in you data*/
> > sum wage, detail
> > local bottom25 = r(p25)
> > gen liberal = tenure >`top25' & wage < `bottom25' /*
> > */ if !missing(tenure,wage)
> >
> > twoway kdensity grade if liberal || /*
> >     */ kdensity grade,  /*
> >     */ legend(label(1 "only liberals") /*
> >           */  label(2 "general population"))
> > *-------------- end example ----------------
> > (For more on how to use examples I sent to the Statalist, see:
> > http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html )


-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


      ___________________________________________________________ 
Yahoo! Mail is the world's favourite email. Don't settle for less, sign up for
your free account today http://uk.rd.yahoo.com/evt=44106/*http://uk.docs.yahoo.com/mail/winter07.html 
*
*   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