[R] strange thing with sd

Chuck Cleland ccleland at optonline.net
Mon Mar 29 16:22:41 CEST 2004


Perhaps this is related to PR#1228

http://r-bugs.biostat.ku.dk/cgi-bin/R/Accuracy?id=1228;user=guest

which seems to have been improved in recent versions.

>>>>Andreas Pauling <pauling at giub.unibe.ch> 3/29/2004 9:01:40 AM >>>
> 
> Dear R people
> 
> I came across a strange thing: 
> 
> 
> sd(rep(0.01,      15))  #0
> sd(rep(0.001,     15))  #4.489023e-19
> sd(rep(0.00001,   15))  #0
> sd(rep(0.00000001,15))  #1.712427e-24
> 
> sd(rep(0.01,      13))  #1.805557e-18
> sd(rep(0.001,     13))  #4.513894e-19
> sd(rep(0.00001,   13))  #0
> sd(rep(0.00000001,13))  #0
> 
> sd(rep(5.01,	  15))  #0
> sd(rep(5.001,	  15))  #4.489023e-19
> sd(rep(5.00001,   15))  #1.838704e-15
> sd(rep(5.00000001,15))  #9.19352e-16
> 
> sd(rep(5.01,	  13))  #9.244454e-16
> sd(rep(5.001,	  13))  #9.244454e-16
> sd(rep(5.00001,   13))  #1.848891e-15
> sd(rep(5.00000001,13))  #0
> 
> Why gives sd sometimes zero and sometimes values close to zero
> and why does it depend on the value and on how many times it is
> repeated?
> Shouldn't it give always zero?
> Is there a way to control this?
> ...

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 452-1424 (M, W, F)
fax: (917) 438-0894




More information about the R-help mailing list