Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: RE: RE: RE: RE: scatter options in -ciplot-


From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: RE: RE: RE: RE: scatter options in -ciplot-
Date   Mon, 24 Jan 2011 13:03:35 +0000

Here are some ideas on how to do it. 

sysuse auto, clear 

foreach v in price mpg weight length { 
	local which`v' "`: var label `v''" 
	statsby mean`v'=r(mean) ub`v'=r(ub) lb`v'=r(lb), by(rep78) saving(`v', replace) : ci `v' 
} 

use price, clear 
label var mean`v' "`whichprice'" 

foreach v in mpg weight length { 
	merge 1:1 rep78 using `v' 
	assert _merge == 3 
	label var mean`v' "`which`v''" 
	drop _merge 
}

gen rep78_1 = rep78 - 0.15
gen rep78_2 = rep78 - 0.05 
gen rep78_3 = rep78 + 0.05 
gen rep78_4 = rep78 + 0.15

twoway ///
rcap ubprice lbprice rep78_1, lcolor(black) || ///
rcap ubmpg lbmpg rep78_2, lcolor(pink) || ///
rcap ubweight lbweight rep78_3, lcolor(green) || ///
rcap ublength lblength rep78_4, lcolor(blue) || ///
scatter meanprice rep78_1, mcolor(black) ms(Oh) || ///
scatter meanmpg rep78_2, mcolor(pink) ms(Dh)  || ///
scatter meanweight rep78_3, mcolor(green) ms(Th) || ///
scatter meanlength rep78_4, mcolor(blue) ms(Sh)  /// 
xla(1/4) xtitle("`: var label rep78'") legend(order(5 6 7 8)) 
	

Nick 
[email protected] 


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Trelle Sven
Sent: 24 January 2011 12:45
To: [email protected]
Subject: st: RE: RE: RE: scatter options in -ciplot-

Dear Nick,
thanks for the advice. I will do that.

BW/Sven


> This reinforces the suggestion that with -statsby- you can 
> design your own graphs. 
> 
> Nick
> [email protected] 
> 


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

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index