From msa at biostat.mgh.harvard.edu  Fri Apr  9 18:46:14 2004
From: msa at biostat.mgh.harvard.edu (msa@biostat.mgh.harvard.edu)
Date: Fri Apr  9 18:46:16 2004
Subject: [Rd] Incorrect handling of NA's in cor() (PR#6750)
Message-ID: <20040409164614.9E0AD10478@slim.kubism.ku.dk>

Full_Name: Marek Ancukiewicz
Version: 1.8.1
OS: Linux
Submission from: (NULL) (132.183.12.87)


Function cor() incorrectly handles missing observation with method="spearman":

> x <- c(1,2,3,NA,5,6)
> y <- c(4,NA,2,5,1,3)
> cor(x,y,use="complete.obs",method="s")
[1] -0.1428571
> cor(x[!is.na(x)&!is.na(y)],y[!is.na(x)&!is.na(y)],method="s")
[1] -0.4

These two results should be the same.


[Rd] Incorrect handling of NA's in cor() (PR#6750)
msa@biostat.mgh.harvard.edu