Re: [R] correlation

From: Bernard Leemon <bernie.leemon_at_gmail.com>
Date: Fri, 8 Feb 2008 14:47:59 -0700

It is easy to worry too much about using numbers to represent order when using statistics like the correlation. this little example shows that the correlation is essentially a rank-order correlation itself:
> x <- 1:20
> y <- x^2
> cor(x,y)
[1] 0.9713482

x and y are definitely not linearly related, yet the correlation is extremely high. As Peter suggests, you could be 'safe' using a Spearman correlation, which is identical to cor(rank(x), rank(y)). But the rank transform may be more destructive to your data than need be.

gary mcclelland
colorado

On Fri, Feb 8, 2008 at 9:14 AM, <darteta001_at_ikasle.ehu.es> wrote:

> Dear list
>
> I would like to compare two measurements of disease severity (M1 and
> M2), one of the is continuous (M1 ranging from 1 to 10) and the other
> is ordinal (M2 takes Low, Medium, high and very high). Do you think is
> ok to use cor() function to test whether the two agree, i.e correlate?
> I am afraid that if I set M2 to 1,2,3 and 4, the function cor() will
> take them as continuous and therefore lose intrepretation.
>
> Thanks for your commments
>
> David
>
> ______________________________________________
> R-help_at_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.
>

        [[alternative HTML version deleted]]



R-help_at_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. Received on Fri 08 Feb 2008 - 21:50:55 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 08 Feb 2008 - 22:30:13 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive