Statalist The Stata Listserver

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

st: RE: Further query on twoway bars for 2 rates

From   "Thuy Le" <[email protected]>
To   <[email protected]>
Subject   st: RE: Further query on twoway bars for 2 rates
Date   Tue, 06 Jun 2006 23:29:45 -0400

I found the solution.
Copy and paste the following sample data:

statefips	age	senior	age_l	age_h	senior_l	senior_h
statefips1	statefips2
1	35.5416	13.7	35.04163	36.04163	13.2	14.2	0.75
3	28.442	4.3	27.942	28.942	3.8	4.8	2.75	3.25
5	34.4531	13.2	33.95309	34.95309	12.7	13.7	4.75
7	36.3938	15.8	35.89377	36.89377	15.3	16.3	6.75

Basically, you generate statefips1 (and 2) by substracting (adding) 0.25 to
statefips. The age_l and age_h are lower and upper bounds artificially
generated for age. The same for senior.

Then, you can use this to create the graph:

twoway (bar age  statefips1, barw(.5)) (rcap  age_l age_h  statefips1) (bar
senior  statefips2, barw(.5)) (rcap  senior_l senior_h  statefips2)

Of course, you need to relabel it a little bit.

Let me know your final results.


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Daniel Exeter
Sent: Tuesday, June 06, 2006 6:20 PM
To: [email protected]
Subject: st: Further query on twoway bars for 2 rates

Hi folks, 

Thanks to those who replied yesterday. Perhaps my request wasn't clear. 

I want to map rates for males and females, with 95% CIs, by a group variable
(e.g. region). 

If I use the syntax
graph twoway (bar rate1 groupvar,(barw(0.5))  (rcap lb1 ub1 groupvar ) (bar
rate2 groupvar, barw(0.5))  (rcap lb2 ub2 groupvar), ; #d cr

I obtain a graph where the bars for males and females and their CI's are
plotted. However, the two bars are upon one another. 

Is there a way to somehow shift the rate2 bars and CIs to the right, so that
they have an appearance similar to the command

Graph bar (asis) rate1 rate2, over(groupvar) 

With the confidence intervals attached?


*   For searches and help try:

*   For searches and help try:

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