From p.dalgaard at biostat.ku.dk  Wed Mar  3 23:45:27 2004
From: p.dalgaard at biostat.ku.dk (Peter Dalgaard)
Date: Wed Mar  3 23:44:54 2004
Subject: [Rd] cor(..., method="spearman") or cor(...,
	method="kendall") (PR#6641)
In-Reply-To: <20040303200039.6930EEC5B@slim.kubism.ku.dk>
References: <20040303200039.6930EEC5B@slim.kubism.ku.dk>
Message-ID: <x23c8pbldk.fsf@biostat.ku.dk>

JRitter@hhh.umn.edu writes:

> Dear R maintainers,
> 
> R is great.  Now that I have that out of the way, I believe I have
> encountered a bug, or at least an inconsistency, in how Spearman and
> Kendall rank correlations are handled.  Specifically, cor() and
> cor.test() do not produce the same answer when the data contain NAs.

We know... PR#6448 is the same thing. (The problem is that rank()
follows sort() which by default sorts NA's to the end of the sorted
vector. Thus NA's get a high rank and if both x and y have NA at the
same time, a high spearman correlation is calculated.) It is fixed in
the patched R version and also in the development sources (soon to be
1.9.0). 

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907


[Rd] cor(..., method="spearman") or cor(..., method="kendall") (PR#6641)
Peter Dalgaard