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   Mon, 30 Apr 2007 12:51:29 +0100 (BST)

--- [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?

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! Answers - Got a question? Someone out there knows the answer. Try it
now.
http://uk.answers.yahoo.com/ 
*
*   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