Re: [R] 1-Pearson's R Distance

2008-11-28 Thread Rodrigo Aluizio
Claudia, Thomas and William thank you all so much.
It's exactly what we needed.
Works perfectly.

Rodrigo.

-Mensagem original-
De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Em nome de Claudia Beleites
Enviada em: quinta-feira, 27 de novembro de 2008 14:01
Para: r-help@r-project.org
Assunto: Re: [R] 1-Pearson's R Distance

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: [EMAIL PROTECTED]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] 1-Pearson's R Distance

2008-11-27 Thread William Revelle

At 5:00 PM +0100 11/27/08, Claudia Beleites wrote:

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



From the law of cosines, d = sqrt(2(1-r)) is a somewhat more 
appropriate transformation of a Pearson correlation to a distance.


Although this is monotonically related to the (1-r)/2, by taking the 
square root  it will lead to somewhat different solutions in 
clustering.


Bill

--
William Revelle http://personality-project.org/revelle.html
Professor   http://personality-project.org/personality.html
Department of Psychology http://www.wcas.northwestern.edu/psych/
Northwestern University http://www.northwestern.edu/
Attend  ISSID/ARP:2009   http://issid.org/issid.2009/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] 1-Pearson's R Distance

2008-11-27 Thread Thomas Petzoldt

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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] 1-Pearson's R Distance

2008-11-27 Thread Claudia Beleites
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: [EMAIL PROTECTED]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] 1-Pearson's R Distance

2008-11-27 Thread Rodrigo Aluizio
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.   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]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.