[R] 1-Pearson's R Distance

Thomas Petzoldt thpe at simecol.de
Thu Nov 27 18:37:54 CET 2008

Rodrigo Aluizio wrote:
> Hi again List,
> Well this time I?m writing for a friend (really J). He needs to create a
> distance matrix based on an abundance matrix using the 1-Pearson?s R index.
> Well I told him to look at the proxy package, but there is only Pearson
> Index. He needs it to perform a clustering. Well, as soon as he told me
> there proxy only had the Pearson index I thought: ?He could just do
> something like
>> NewObject<-1-PearsonMatrixObject?
> But I didn?t tell him that because I?m not sure it?s the same thing, and it
> probably will generate a strange cluster with the braches ends distant from
> the base?
> He told me that Statistica 7.0 has this Index, but he doesn?t own it. So? Is
> there a way on R to do this correctly?
> Thanks for the attention.

The help file of dist has an example how to do this:


## Use correlations between variables "as distance"
dd <- as.dist((1 - cor(USJudgeRatings))/2)

Note the division by 2! Correlations can be between -1 ... +1 and 
negative distances make no sense.

Another approach is r^2, but this has, of course, a different 


More information about the R-help mailing list