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. ___________________________________ MSc. <mailto:r.aluizio@gmail.com> Rodrigo Aluizio Centro de Estudos do Mar/UFPR Laboratório de Micropaleontologia Avenida Beira Mar s/n - CEP 83255-000 Pontal do Paraná - PR - BRASIL Fone: (0**41) 3455-1496 ramal 217 Fax: (0**41) 3455-1105 [[alternative HTML version deleted]]
Hi Rodrigo, afaik, (1 - r_Pearson)/2 is used rather than 1 - r_Pearson. This gives a distance measure ranging between 0 and 1 rather than 0 and 2. But after all, dies does not change anything substantial. see e.g. Theodoridis & Koutroumbas: Pattern Recognition. I didn't know of the proxy package, but the calculation it straightforward (though a bit wasteful I suspect: first the whole matrix is produced, and as.dist cuts it down again to a triangular matrix): as.dist (0.5 - cor (t(x) / 2)) Take care wheter you want to use x or t(x). HTH Claudia -- Claudia Beleites Dipartimento dei Materiali e delle Risorse Naturali Universit? degli Studi di Trieste Via Alfonso Valerio 6/a I-34127 Trieste phone: +39 (0 40) 5 58-34 47 email: cbeleites at units.it
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: >?dist ## 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 interpretation. ThPe