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

st: RE: alternative to rcap


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: alternative to rcap
Date   Mon, 1 Mar 2004 10:19:38 -0000

-twoway rcap- here draws the bars. To do what 
you want you need to add other graph elements. 

Alternatively, as a canned solution, 
-serrbar- will get you most of the way. 

serrbar mean se x, scale(2) 

Connecting only for the same country and sex
complicates matters, however. 

Something like this should help. 

preserve 
bysort country sex : gen last = _n == _N 
expand 2 if last
bysort country sex : replace mean = . if _n == _N 
by country sex : replace x = . if _n == _N 
serrbar m se x, mvopts(c(l) cmissing(no)) 
restore 

Nick 
[email protected] 

Dimitriy V. Masterov
> 
> I can't seem to figure this out. I have data from a table that I would
> like to plot. The data looks like this:
> 
> country		sex	mean	se	x
> USA		Male	269.34	(2.29)	1
> USA		Female	277.60	(2.17)	1
> England		Male	267.80	(2.52)  1
> England		Female	266.78	(2.56)  1
> Scotland	Male	264.91	(4.69)	1
> Scotland	Female	267.65	(3.56)	1
> .		.	.	.
> .		.	.	.
> Scotland	Female  400.65  (4.73)  10
> 
> 
> I would like to plot the means for each country-sex cell 
> (with t-shaped
> error bars that are +/- 2*se) as lines with x on the x-axis.
> I could do this with twoway rcap by defining y1=y+2*se and 
> y2=y-2*se, but
> that only plots the error bars without connecting the points. Is
> there a way to connect the points or is there a better alternative to
> this?

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