> > The formula I generally use to compute the standard deviation is the
> square root of the variance where the variance is E(X^2) - (E(x))^2. 

Even if that is what you want, I hope you don't _implement_ it that way (eg as 
mean(x^2)-mean(x)^2.  _Serious_ numerical rounding issues...

#Example: 
set.seed(1023)
x<-rnorm(200, 1e9)
# Compare 
199*var(x)/200 #"Population" variance

#with
mean(x^2)-mean(x)^2

#Other seeds give differently wrong numbers.
#See  FAQ 7.31 for why

S Ellison



*******************************************************************
This email and any attachments are confidential. Any use, copying or
disclosure other than by the intended recipient is unauthorised. If 
you have received this message in error, please notify the sender 
immediately via +44(0)20 8943 7000 or notify postmas...@lgcgroup.com 
and delete this message and any copies from your computer and network. 
LGC Limited. Registered in England 2991879. 
Registered office: Queens Road, Teddington, Middlesex, TW11 0LY, UK
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to