Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: Quick display of categorical data


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: Quick display of categorical data
Date   Fri, 27 Jun 2008 14:01:51 +0100

Martin's answer focuses on tabular displays. Here are seven ways to get
a graph. There will be others.  

Official Stata: 

tabulate rep78, plot
histogram rep78, discrete
dotplot rep78
quantile rep78 

The last is best for ordinal variables. 

User-written commands: 

stripplot rep78, stack 
catplot hbar rep78 
qplot rep78 

-stripplot- and -catplot- are on SSC. -qplot- is on the SJ website.
-qplot- is best for ordinal variables. 

See also a discussion: 

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

That is the public domain via
<http://www.stata-journal.com/sjpdf.html?articlenum=gr0004>

Nick 
n.j.cox@durham.ac.uk 

Martin Weiss

Try this:

sysuse auto, clear
foreach var of varlist rep78 for{
ta `var'
inspect `var'
}

Admittedly quick and dirty...

Zitat von "Michael I. Lichter" <MLichter@Buffalo.EDU>:

> I'm beginning to analyze
> some survey data, and much of the data consists of responses to
> questions on a 1-5 scale, a few responses on a 1-3 scale, and a few
> responses to limited nominal scales. I have too many cases (1,000+) to
> learn anything from a stemplot (although I suppose I could sample 1/10
> of the cases for this purpose), which isn't meant for categorical data
> anyway, and it's way, way too cumbersome to individually create and
> print bar charts using Stata graphics (unless there's something I
don't
> know about how to do this, which is likely). Ideally, what I'd like is
> a display something like this:
>
> Some inter |
> esting var |
>      iable |      Freq.     Percent        Cum.
> ------------+-----------------------------------         Never, ever |
>       315       30.79       30.79        30 X           X
> Maybe once |        204       19.94       50.73           X
X
> Occasionlly |        149       14.57       65.30        20 X  X
X
> Pretty oftn |         55        5.38       70.67           X  X  X
X
>    Always! |        300       29.33      100.00        10 X  X  X
X
> ------------+-----------------------------------           X  X  X  X
X
>      Total |      1,023      100.00                       1  2  3  4
5
>
> I would happily settle for just the ASCII bar chart, and a horizontal
> bar would be fine. The point is to be able to get a sense of the data
> at a glance, without wasting a bunch of paper. 

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index