Statalist


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

Re: st: RE: Bar chart to display results from crosstabs


From   Geoffrey Wallace <[email protected]>
To   [email protected]
Subject   Re: st: RE: Bar chart to display results from crosstabs
Date   Thu, 12 Feb 2009 12:58:29 -0500

Hi Nick,

I was able to get the basic outlines of what I was looking for using -spineplot- and will only need to tinker with the options to get the desired appearance.

Thanks again, this was really helpful.

Cheers, Geoff

Nick Cox wrote:
-graph bar- is not much use directly. You would need to do some
pre-processing first. (The essential reason is that -graph bar- is a
wrapper for -collapse-, not -contract-.) See -catplot- and -tabplot- on SSC which give more direct solutions.
Also, -spineplot- on the Stata Journal site. Use -findit- to get
locations. And two papers in the Stata Journal itself:
SJ-8-1  gr0031  . . . . . . . . . . . Speaking Stata: Spineplots and
their kin
        (help spineplot if installed) . . . . . . . . . . . . . . .  N.
J. Cox
        Q1/08   SJ 8(1):105--121
        discusses spineplots (mosaic plots), a type of bar chart for
        showing frequencies, proportions, or percentages of cross-
        classified categorical variables

SJ-4-2  gr0004  .  Speaking Stata: Graphing categorical and
compositional data
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N.
J. Cox
        Q2/04   SJ 4(2):190--215                                 (no
commands)
        discusses graphical possibilities for categorical and
        compositional data

The last is accessible to all under the SJ's 3-year rule. Nick [email protected] Geoffrey Wallace, Ph.D. candidate I want to use a bar chart to display in a more visual manner the column percentages from a crosstab for two dichotomous variables, such as democracy and first violator.

For the two-way table, I used the command
--tab democ firstviol, column--

Which gives the following output.


      First |       Democracy
   violator |        No        Yes |     Total
-----------+----------------------+----------
         No |        89         40 |       129
            |     57.05      72.73 |     61.14
-----------+----------------------+----------
        Yes |        67         15 |        82
            |     42.95      27.27 |     38.86
-----------+----------------------+----------
      Total |       156         55 |       211
            |    100.00     100.00 |    100.00

The final product I would hope for in the corresponding bar would have two separate pairs of columns. The first fair would have the relative percentages for democracies (democ=1) and nondemocracies (democ=0) that are not first violators (firstviol=0) (i.e. 72.73 and 57.05), and the second would be the corresponding pair for first violators (firstviol=1)

(i.e. 27.27 and 42.95).

I'm assuming I would use some version of the -graph bar- command, but I'm having trouble figuring how to specify the column percentages.


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

--
Geoffrey Wallace
PhD Candidate
Department of Government
214 White Hall
Cornell University
Ithaca, NY 14853
t.202.302.4209
f.607.255.4530
http://www.people.cornell.edu/pages/gw46/
*
*   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/



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