Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

stacked bar charts [was: Re: st: RE: Features for Stata 14]


From   Nick Cox <njcoxstata@gmail.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   stacked bar charts [was: Re: st: RE: Features for Stata 14]
Date   Tue, 18 Feb 2014 16:29:31 +0000

Perhaps Ronan's answer was focused on (the lack of) official
offerings. but stacked bar charts are available to consenting adults
using -catplot- (SSC).

. sysuse auto
(1978 Automobile Data)

. catplot rep78 foreign, stack percent(foreign)

. catplot rep78 foreign, asyvars stack percent(foreign)

. catplot rep78 foreign, asyvars stack percent(foreign) ///
bar(1, bcolor(red*0.4)) bar(2, bcolor(red*0.2)) ///
bar(3, bcolor(blue*0.2)) bar(4, bcolor(blue*0.4)) bar(5, bcolor(blue*0.6)) ///
legend(row(1))

Nick
njcoxstata@gmail.com

On 18 February 2014 15:07, Ronan Conroy <rconroy@rcsi.ie> wrote:
> These are small suggestions, but come up in teaching sessions with my doctoral students.
>
>
> 1. Pie charts, though I seldom draw one, have a syntax that seems to fly in the face of Stata usage. Nick Cox's -pieplot- is a model of the syntax that ought to be employed.
>
> 2. Creating indicator variables for the categories of a variable requires use of the -tabulate- command and the -generate- option. This is awkward, and users could be forgiven for not knowing the option was there. A separate command would be more useful and immediately visible.
>
> 3. Stacked bar charts of a categorical variable need to be drawn (I think - please tell me if there's an easier way!) by creating dummy variables (using the awkward -tabulate- route!)
>
> . qui tab infection_route, gen(inf_)
> . gr hbar (mean) inf_*, over(sex) stack percent
>
> And even here, the legend needs a bit of a tidy
>
> 4. The -proportions- command should allow the use user choice of methods to generate confidence intervals. The current formula, based on a logit transformation, is at least preferable to the normal approximation method that was previously used, but the resulting intervals are still wider than those obtained in smaller samples using the Wilson or (equivalent) Jeffrey's methods, which perform better in simulation studies. The -proportions- command should allow you to choose your method, just as the -ci- command does.
>
> 5. The dialogue for -twoway- tables with measures of association uses "within-column/row relative frequency" and "relative frequencies" to refer to what any mortal would call column, row and total percents. My students find it a little bewildering.
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index