[R] Variance of a single number

Brian D Ripley ripley at stats.ox.ac.uk
Tue Dec 10 11:52:02 CET 2002


On Tue, 10 Dec 2002, Adaikalavan Ramasamy wrote:

> Just out of curiosity, can some please explain the following return NA.
>
> x <- 6
> var(x)
>
> y <- c( NA, NA, 10000 )
> var(y, na.rm=T)
>
>
> Unless I am seriously misguided, I believe that the variance of a single
> number (i.e. a constant) should be zero. Thanks.

You are.  It's an estimate of the population variance, about which there
is no information at all in one number.  Or just look at the formula,
which gives 0/0.




More information about the R-help mailing list