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

st: RE: Quintile lines in Area chart (or any chart)


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Quintile lines in Area chart (or any chart)
Date   Tue, 8 Jun 2004 18:52:34 +0100

It is possible in Stata. One way to do it is this. 
The following program displays quintiles: 

program quintiles, rclass 
	version 8 
	syntax varname(numeric) [if] [in] [aweight fweight]	
	marksample touse
	qui count if `touse' 
	if r(N) == 0 error 2000
	
	su `varlist' [`weight' `exp'] if `touse', meanonly 
	local quint "`r(min)',"
	local q "`r(min)' "
	local max `r(max)' 
	_pctile `varlist' [`weight' `exp'] if `touse', nq(5) 
	forval i = 1/4 { 
		local quint "`quint'`r(r`i')',"  
		local q "`q'`r(r`i')' "  
	} 
	local quint "`quint'`max'" 
	local q "`q' `max'" 
	di as res "`quint'" 
	return local q "`q'" 
end 	

Then you can type the quintiles in a call to -xline()-
(or -yline()-) on any suitable graph. 

Also see -eqprhistogram- on SSC. With the option -bin(5)- 
you will see the blocks defined by quintiles. 

Nick 
[email protected] 

Branco Ponomariov
 
> I am not very familiar with the graphing functions in stata 
> yet, and I have the following problem:
> 
> For some basic stats (frequencies) I also need to make it 
> visible how are
> the observed values concentrated/dispersed across different 
> quintiles. I
> have to present the data as an area chart format and have the 
> quintile lines
> drawn from the x axis up to the frequency line - e.g. to show 
> at which value
> the first quintile end and so on. So far I have not found a single
> stats/spreadsheet package that can do that - excel, spss, 
> sigma plot cannot
> do that. Is this possible in stata and how?

*
*   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