[Rd] variance of a scalar (PR#546)
Prof Brian Ripley
Prof Brian Ripley <ripley@stats.ox.ac.uk>
Fri, 19 May 2000 09:48:53 +0100 (BST)
> 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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._