[R] computing the variance

From: Wang Tian Hua <wangth_at_bii-sg.org>
Date: Mon 05 Dec 2005 - 19:53:00 EST

when i was computing the variance of a simple vector, i found unexpect result. not sure whether it is a bug.
> var(c(1,2,3))

[1] 1 #which should be 2/3.
> var(c(1,2,3,4,5))

[1] 2.5 #which should be 10/5=2

it seems to me that the program uses (sample size -1) instead of sample size at the denominator. how can i rectify this?


R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Dec 05 20:01:31 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:41:28 EST