From Prof Brian Ripley <ripley@stats.ox.ac.uk>  Fri May 19 09:48:53 2000
From: Prof Brian Ripley <ripley@stats.ox.ac.uk> (Prof Brian Ripley)
Date: Fri, 19 May 2000 09:48:53 +0100 (BST)
Subject: [Rd] variance of a scalar (PR#546)
Message-ID: <200005190848.JAA22344@toucan.stats.ox.ac.uk>

> From: J.C.Rougier@durham.ac.uk
> Date: Fri, 19 May 2000 10:42:04 +0200 (MET DST)
> 
> I was surprised to find that the variance of a scalar, using
> var(), is NA.  Surely this should be zero?
> 

Do you mean a vector of length 1? (S has no scalars.)  No, it should be
NA, as sum((x-xbar)^2)/(n-1) is NaN, or, in statistical terms, one has
no idea at all of the variability from a single sample.

S gives NA too.


-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] variance of a scalar (PR#546)
Prof Brian Ripley