Skip to content

variance of a scalar (PR#546)

3 messages · Jonathan Rougier, Uwe Ligges, Peter Dalgaard

#
I was surprised to find that the variance of a scalar, using
var(), is NA.  Surely this should be zero?

Cheers, Jonathan.

--please do not edit the information below--

Version:
 platform = sparc-sun-solaris2.7
 arch = sparc
 os = solaris2.7
 system = sparc, solaris2.7
 status = Patched
 major = 0
 minor = 99.0
 year = 2000
 month = February
 day = 9
 language = R

Search Path:
 .GlobalEnv, package:HistoryMatch, package:zmatrix, package:stepfun, package:Simulator, Autoloads, package:base

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
J.C.Rougier@durham.ac.uk wrote:
1. This is ok. var(.) is defined as:
   var(x)= (1 / (n - 1)) * sum(x - mean(x))^2
                 ^^^^^
If you has got a scalar: n - 1 = 0, so it is undefined!
You should upgrade to 1.0.1

Regards,
Uwe Ligges
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
J.C.Rougier@durham.ac.uk writes:
I don't think so. There's a divide by zero involved.