[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
"Austin Nichols" <austinnichols@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: how to make an area graph showing distribution? |

Date |
Sun, 30 Nov 2008 21:02:12 -0500 |

Gisella Young <gisellayoung@yahoo.com>: It may be that you are looking for a simple stacked bar graph over income quintiles or deciles or the like, as opposed to a parametric smooth over income quantiles. If so, you might want to adapt one of this pair of example graphs to your needs: clear all sysuse nlsw88 ren industry i tab i, g(ind) g w=round(uniform()*20) la var w "fake survey weight" _pctile wage [pw=w], nq(5) g q=1 if wage<=r(r1) forv i=2/5 { replace q=`i' if wage>r(r`=`i'-1') & wage<=r(r`i') } loc y forv i=1/12 { loc l "`=substr("`: var la ind`i''",4,.)'" loc y `"`y' lab(`i' "`l'")"' loc lv`i' `"la var ind`i' "`l'" "' } gr bar ind* [pw=w], stack over(q) name(b) leg(`y') collapse ind* [pw=w], by(q) forv i=2/12 { replace ind`i'=ind`i'+ind`=`i'-1' } loc v forv i=1/12 { `lv`i'' loc v "ind`i' `v'" } tw bar `v' q, name(tw) Note that the commands above destroy the data in memory, so make sure you -preserve- or -save- first as appropriate. Also note that there is no guarantee that the distributions of income by occupation, or occupation by income category, display any sort of stochastic dominance that would allow easy ranking of occupations. See also http://www.stata.com/capabilities/graphexamples.html On Sun, Nov 30, 2008 at 10:37 AM, Maarten buis <maartenbuis@yahoo.co.uk> wrote: > --- Gisella Young <gisellayoung@yahoo.com> wrote: >> On Maarten Buis's suggestion, I am not sure why I would really need >> a regression - I get from his email that this is basically for >> smoothing? > > Yes, as income in the example dataset (and I assume in your dataset as > well) is a continuous variable, there just aren't enough cases for each > income value to estimate the proportions. > >> Since I actually want to plot the actual data (but realise >> that this needs smoothing), * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**Re: st: how to make an area graph showing distribution?***From:*Gisella Young <gisellayoung@yahoo.com>

**Re: st: how to make an area graph showing distribution?***From:*Maarten buis <maartenbuis@yahoo.co.uk>

- Prev by Date:
**Re: st: Dummy variable p value question** - Next by Date:
**st: problem with delimit ; and // comenting** - Previous by thread:
**Re: st: how to make an area graph showing distribution?** - Next by thread:
**Re: st: Multinomial transition model with unobserved heterogeneity** - Index(es):

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