[R] correlation between XY coordinates
Christopher Kurby
kurbyc at gvsu.edu
Sun May 6 14:06:25 CEST 2012
Hey Josh (and everyone),
My apologies, let me be more specific. I have two sets of XY coordinates in Cartesian space. I would like to compute a correlation between the two sets. For example, let's say I have two N X 2 matrices, with the first column being the X coordinate, the second column being the Y, and with each row being a new observation. I would like to know the strength the relationship between the two sets of coordinates (matrices). cancor provides two separate correlations, but I want a single value representing the strength of the relationship. Is this more clear?
Chris
On May 5, 2012, at 11:44 PM, Joshua Wiley wrote:
> Hi Chris,
>
> As Jeff mentioned, it is hard to tell what you want (correlations
> between sets of coordinates could mean many things it seems like to
> me), but here is something that perhaps helps:
>
> ## some data (usually nice if you provide this rather than us having
> to make something up)
> d1 <- cbind(x <- rnorm(100), y <- rnorm(100))
> d2 <- cbind(x2 = x + rnorm(100), y2 = y + rnorm(100))
>
> ## canonical correlation of the two matrices
> cancor(d1, d2)
>
> ## simple correlation matrix of each dataset
> cor(d1)
> cor(d2)
>
> Cheers,
>
> Josh
>
> On Sat, May 5, 2012 at 5:32 PM, Christopher Kurby <kurbyc at gvsu.edu> wrote:
>> Hello r world,
>>
>> Does anyone know a function or package that can compute correlations between sets of XY coordinates?
>>
>> Thanks in advance for your help,
>> Chris
>>
>> ______________________________________________
>> 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.
>
>
>
> --
> Joshua Wiley
> Ph.D. Student, Health Psychology
> Programmer Analyst II, Statistical Consulting Group
> University of California, Los Angeles
> https://joshuawiley.com/
More information about the R-help
mailing list