Chris, I think that you really need to quantify what you mean by correlation. Things to consider would depend on what the matrices represent--are they the estimates of the same set of N geographic points, are they traces of the same line, are they traces of the same polygon outline? If either of the latter two, then there would be no reason to believe that they had the same number of points. But the answer to the specific question would dictate how the correlation was computed. Dave
below extracted from R-help Digest, Vol 111, Issue 7 Date: Sun, 6 May 2012 08:42:54 -0400 From: Sarah Goslee <sarah.gos...@gmail.com> To: Christopher Kurby <kur...@gvsu.edu> Cc: "r-help@r-project.org" <r-help@r-project.org> Subject: Re: [R] correlation between XY coordinates Message-ID: <4a58b3c4-c5b6-4c22-a7d3-bd79b8c1f...@gmail.com> Content-Type: text/plain; charset=us-ascii Hi Chris, To get a single value you might need something like a Mantel test, available in both ecodist and vegan. That test is a permutation test of significance of the correlation between two distance matrices. Sarah On May 6, 2012, at 8:06 AM, Christopher Kurby <kur...@gvsu.edu> wrote: > 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 <kur...@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@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/ > > ______________________________________________ > 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. [[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.