weijian21cn
2010-Aug-18 21:11 UTC
[R] How to measure correlations in terms of distance and draw them on a 2-dimmentional plot?
Hi, Suppose I have n variables, X1, X2, ..., Xn and want to visualize the pairwise correlations on a 2-dimmensional plot. In particular, I plan to mark down n dots on a piece of paper and dot i represents Xi, in a way such that the highly correlated variables are placed closer; that is, shorter the distance between two dots the higher the correlation are between two corresponding variables. Do you guys know any R packages can draw such plots? Thank you very much in advance! Weijian -- View this message in context: http://r.789695.n4.nabble.com/How-to-measure-correlations-in-terms-of-distance-and-draw-them-on-a-2-dimmentional-plot-tp2330413p2330413.html Sent from the R help mailing list archive at Nabble.com.
David Winsemius
2010-Aug-18 21:28 UTC
[R] How to measure correlations in terms of distance and draw them on a 2-dimmentional plot?
On Aug 18, 2010, at 5:11 PM, weijian21cn wrote:> > Hi, > > Suppose I have n variables, X1, X2, ..., Xn and want to visualize the > pairwise correlations on a 2-dimmensional plot. In particular, I > plan to > mark down n dots on a piece of paper and dot i represents Xi, in a > way such > that the highly correlated variables are placed closer; that is, > shorter the > distance between two dots the higher the correlation are between two > corresponding variables. Do you guys know any R packages can draw such > plots?I didn't quite follow wwhat your strategy was but have you looked at lattice::splom?> > Thank you very much in advance! > > Weijian > -- > View this message in context: http://r.789695.n4.nabble.com/How-to-measure-correlations-in-terms-of-distance-and-draw-them-on-a-2-dimmentional-plot-tp2330413p2330413.html > Sent from the R help mailing list archive at Nabble.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.David Winsemius, MD West Hartford, CT
weijian21cn
2010-Aug-18 21:47 UTC
[R] How to measure correlations in terms of distance and draw them on a 2-dimmentional plot?
Probably I put it too complicated. I just try to draw 10 points on a plot. Each point stand for one variable. If two variables are highly correlated, the corresponding dots are to be drawn closer. Say, variable X1, X2, X3, are highly correlated among them, so they will be clustered; variables X4, X5, X6 are not much correlated with X1,X2, X3, so X4-X5 are drawn far away from X1-X3. In addition, if corr(X1, X2) > corr(X2,X3), the plot can show distance(X1, X2) < distance(X2, x3). Do you know if R has such a package? Or I may use some plot function from cluster analysis? Thank you! Weijian -- View this message in context: http://r.789695.n4.nabble.com/How-to-measure-correlations-in-terms-of-distance-and-draw-them-on-a-2-dimmentional-plot-tp2330413p2330442.html Sent from the R help mailing list archive at Nabble.com.
Greg Snow
2010-Aug-18 21:50 UTC
[R] How to measure correlations in terms of distance and draw them on a 2-dimmentional plot?
Do a search for "multidimensional scaling" and that should give some ideas (use 1-cor or something like that as the distance measure). Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow at imail.org 801.408.8111> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- > project.org] On Behalf Of weijian21cn > Sent: Wednesday, August 18, 2010 3:47 PM > To: r-help at r-project.org > Subject: Re: [R] How to measure correlations in terms of distance and > draw them on a 2-dimmentional plot? > > > Probably I put it too complicated. > > I just try to draw 10 points on a plot. Each point stand for one > variable. > If two variables are highly correlated, the corresponding dots are to > be > drawn closer. Say, variable X1, X2, X3, are highly correlated among > them, so > they will be clustered; variables X4, X5, X6 are not much correlated > with > X1,X2, X3, so X4-X5 are drawn far away from X1-X3. > > In addition, if corr(X1, X2) > corr(X2,X3), the plot can show > distance(X1, > X2) < distance(X2, x3). > > Do you know if R has such a package? Or I may use some plot function > from > cluster analysis? > > Thank you! > > Weijian > -- > View this message in context: http://r.789695.n4.nabble.com/How-to- > measure-correlations-in-terms-of-distance-and-draw-them-on-a-2- > dimmentional-plot-tp2330413p2330442.html > Sent from the R help mailing list archive at Nabble.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.
William Revelle
2010-Aug-19 00:08 UTC
[R] How to measure correlations in terms of distance and draw them on a 2-dimmentional plot?
Weijian, Look at multidimensional scaling functions such as cmdscale or isoMDS (in MASS) or factor analysis (e.g., factanal in core R or fa in the psych package) or item cluster analysis (ICLUST, also in psych). What you will need to think about is how many dimensions best represent the 10 variables. .One will just put them on a line, 2 might or might not work depending upon your data, 3 ... In terms of a distance matrix, in order to use an mds function, first you will need to convert correlations to distances try distance = sqrt (2 *(1-r))., Bill At 2:47 PM -0700 8/18/10, weijian21cn wrote:>Probably I put it too complicated. > >I just try to draw 10 points on a plot. Each point stand for one variable. >If two variables are highly correlated, the corresponding dots are to be >drawn closer. Say, variable X1, X2, X3, are highly correlated among them, so >they will be clustered; variables X4, X5, X6 are not much correlated with >X1,X2, X3, so X4-X5 are drawn far away from X1-X3. > >In addition, if corr(X1, X2) > corr(X2,X3), the plot can show distance(X1, >X2) < distance(X2, x3). > >Do you know if R has such a package? Or I may use some plot function from >cluster analysis? > >Thank you! > >Weijian >-- >View this message in context: >http://r.789695.n4.nabble.com/How-to-measure-correlations-in-terms-of-distance-and-draw-them-on-a-2-dimmentional-plot-tp2330413p2330442.html >Sent from the R help mailing list archive at Nabble.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.
weijian21cn
2010-Aug-19 15:31 UTC
[R] How to measure correlations in terms of distance and draw them on a 2-dimmentional plot?
Thank you all a lot for all the suggestion! -- View this message in context: http://r.789695.n4.nabble.com/How-to-measure-correlations-in-terms-of-distance-and-draw-them-on-a-2-dimmentional-plot-tp2330413p2331408.html Sent from the R help mailing list archive at Nabble.com.
Kjetil Halvorsen
2010-Aug-19 15:42 UTC
[R] How to measure correlations in terms of distance and draw them on a 2-dimmentional plot?
You could also try RSiteSearch("correlation circle") Kjetil On Thu, Aug 19, 2010 at 11:31 AM, weijian21cn <wliang at stern.nyu.edu> wrote:> > Thank you all a lot for all the suggestion! > -- > View this message in context: http://r.789695.n4.nabble.com/How-to-measure-correlations-in-terms-of-distance-and-draw-them-on-a-2-dimmentional-plot-tp2330413p2331408.html > Sent from the R help mailing list archive at Nabble.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. >