Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Multiple (overlaid) Histogram


From   "J. Michael Oakes" <[email protected]>
To   Statalist <[email protected]>
Subject   st: Multiple (overlaid) Histogram
Date   Wed, 28 May 2003 09:42:43 -0500

Using Stata 8, I want to produce a single histogram for MULTIPLE x-point
Likert-scale variables Y1 Y2... Yn (n << 5 for clarity). That is, I'd like
to compare discrete distributions side by side with something like this
(hopefully not mangled example) for two variables Y1 and Y2 over a 3+ point
Likert scale...


       |
       |	         ______
       |	         |    |	        ______
    p  |	         |	  |	        |	 |
    e  |      ______ |    |           |	 |
    r  |      |    | |    |           |    |
    c  |      |    | |    |           |    |
    e  | _____| Y2 | |    |      _____| Y2 |
    n  | |    |    | |    |_____ |    |    |
    t  | | Y1 |    | | Y1 |    | | Y1 |    |
       | |    |    | |    | Y2 | |    |    |
       | |    |    | |    |    | |    |    |
       -----+-------------+-----------+---------->>
            1		  2             3


My data is a conventional structure where respondents are indexed by rows
and outcome variables are in columns, such as:


	_n	 Y1     Y2
    -----   ----  -----
 	1	 1     2
      2	 2     1
      3      1     3
	.      .     .


Given such data, my sense is that the desired graph is technically two
histograms overlaid (like in <twoway>) on each other. But since <histogram>
is not a <twoway> plot such a histogram is not possible: currently
<histogram> can only plot one variable at a time (I think).

While I can imagine transforming my data through some complicated collapse
and append commands, and then using <twoway bar>, this is simply too much
work. Relatedly, I could use Excel and other such programs to produce the
plot easily with summarized data. But I really want to avoid dumping data to
another program, especially Excel.

Am I again missing something, or does <histogram> need some improvement?

Thanks in Advance - Michael Oakes

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