From ihaka@stat.auckland.ac.nz  Sun May 25 23:09:47 1997
From: ihaka@stat.auckland.ac.nz (Ross Ihaka)
Date: Mon, 26 May 1997 10:09:47 +1200 (NZST)
Subject: R-alpha: var() and missing
In-Reply-To: <Pine.SUN.3.95.970523160648.27149A-100000@data>
References: <x2k9krh1hb.fsf@bush.kubism.ku.dk>
 <Pine.SUN.3.95.970523160648.27149A-100000@data>
Message-ID: <199705252209.KAA01030@stat1.stat.auckland.ac.nz>

Thomas Lumley writes:
 > 
 > 
 > var() handles missing values in a very strange way. It is not what the
 > documentation says
 > > var(c(NA,1:10))
 > [1] 0
 > > var(1:10)
 > [1] 9.166667
 > This is because sum() handles NA incorrectly
 > > sum(NA)
 > [1] 0
 > > sum(NA,na.rm=T)
 > [1] 0
 > > sum(NA,na.rm=F)
 > [1] 0
 > 
 > Also the documentation gives a pairwise= option to var() which isn't in
 > the function.

I did want to move toward an implementation which is more like
"na.action", rather than "na.rm".  Often computations based on
correlations based on all observations which are complete for pairs of
variables do make sense.

"var" seems to have been skipped.  What is the right strategy here?
	Ross
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
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
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


R-alpha: var() and missing
Ross Ihaka