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

RE: st: graph mean and sd over/by category


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: graph mean and sd over/by category
Date   Tue, 11 Feb 2003 09:38:58 -0000

Lee Sieswerda
> 
> I was writing a reply to George Hoffman's question, when 
> Vince Wiggins reply
> popped into my mail box. I have a question for Vince. 
> First, here was what I
> was suggesting for George.
> 
> bysort foreign: egen mean = mean(weight)
> bysort foreign: egen sd = sd(weight)
> bysort foreign: gen ub = mean + 
> invttail(_N-1,.025)*(sqrt((sd^2)/_N))
> bysort foreign: gen lb = mean - 
> invttail(_N-1,.025)*(sqrt((sd^2)/_N))
> twoway (rcap lb ub foreign) (scatter mean foreign)
> 
> This gives the same results as -ci-. Specifically, it gives 
> a 95% CI with
> the t critical value based on _N-1 observations within 
> strata (of foreign in
> this case). It is -ci-'s results that I gather Nick Cox is 
> using to produce
> his new -ciplot- (pardon me Nick, if I'm misrepresenting you).

Correct. 

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


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