I didn't spell out how this differs from various
other approaches equally valid. For example, -centile-
will give you a display of the quintiles given the
right request. The point, if there is one, to this
little program is that the quintiles are returned
in r(q), so that e.g.
quintiles mpg
scatter weight mpg, xli(`r(q)')
avoids retyping the numbers. However, you must pick
up r(q) before something else overwrites it.
Nick
[email protected]
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]On Behalf Of Nick Cox
> Sent: 08 June 2004 18:53
> 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/