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
correlation between XY coordinates
5 messages · Christopher Kurby, Jeff Newmiller, Joshua Wiley +1 more
Isn't that one of the main things base R is used for?
Maybe your question is not specific enough. Can you provide some sample data and your best estimate of what the result should look like?
The Posting Guide mentioned below could help you elicit more effective answers.
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.
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.
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/
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/
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 <kurbyc at 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 <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/
______________________________________________ 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.