[R-sig-eco] Distance matrix based on correlation coefficient

Gavin Simpson gavin.simpson at ucl.ac.uk
Tue Jul 20 22:38:23 CEST 2010


On Tue, 2010-07-20 at 23:35 +0300, Jari Oksanen wrote:
> On 20/07/10 22:42 PM, "Gavin Simpson" <gavin.simpson at ucl.ac.uk> wrote:
> 
> > On Tue, 2010-07-20 at 12:12 -0700, Dragos Zaharescu wrote:
> >> I would much appreciate if someone would enlighten me on how to calculate a
> >> distance matrix based on correlation coefficient (Spearman)? The simple
> >> correlation matrix seems not to work.
> > 
> 
> >> 1 - cor(dat) ## dissimilarity
> >
> Actually the canonical transformation to distance is sqrt(2-2*cor(dat)).
> 
> Cheers, Jari Oksanen

Of course, thanks Jari. That 1 - bit was total rubbish, not even
acknowledging that cor could be negative. Not sure what came over me; I
blame the heat here in London ;-)

Hangs head in shame.

G

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



More information about the R-sig-ecology mailing list