Stefan Sobernig
2012-Nov-13 12:05 UTC
[R] How to visualize relation between two sets of rel. frequencies?
I am looking at a data set containing two variables (x,y), each of which represents relative frequencies (rounded): data.frame(x = c(0.1,0.6,0.2,0.1), y = c(0.5,0.2,0.2,0.1)) x y 1 0.1 0.5 2 0.6 0.2 3 0.2 0.2 4 0.1 0.1 each of the rows reflects a "relation" between x and y, for example in row 4: 10% of the observations in x account for 10% of the observations in y. I feel embarrassed, but my mind went blank, and I can't think of a proper way of visualizing this "relation" based on the data above (nor of the appropriate terminology to phrase my question other than "by example"). My apologies and thanks for your hints! //stefan
Richard M. Heiberger
2012-Nov-13 14:54 UTC
[R] How to visualize relation between two sets of rel. frequencies?
This is an interesting exercise. I see at as an application of a Likert plot. I would start with this tmp <- data.frame(x = c(0.1,0.6,0.2,0.1), y = c(0.5,0.2,0.2,0.1)) tmp$xx <- 1 tmp$yy <- tmp$x / tmp$y tmp$xy <- tmp$xx * tmp$x tmp$xxx <- tmp$xx - tmp$xy tmp$yyy <- tmp$yy - tmp$xy tmp ## install.packages(HH) ## if necessaruy require(HH) likert(tmp[, c("xxx","xy","yyy")], xlab="scaled to xxx+xy = 1", sub="xxx+xy = 1, xy/(xxx+xy) = x, xy/(xy+yyy) = y") My guess is that this graph would be more meaningful if it were scaled to counts rather than to xxx + xy = 1. Rich On Tue, Nov 13, 2012 at 7:05 AM, Stefan Sobernig <stefan.sobernig@wu.ac.at>wrote:> I am looking at a data set containing two variables (x,y), each of which > represents relative frequencies (rounded): > > data.frame(x = c(0.1,0.6,0.2,0.1), y = c(0.5,0.2,0.2,0.1)) > > x y > 1 0.1 0.5 > 2 0.6 0.2 > 3 0.2 0.2 > 4 0.1 0.1 > > each of the rows reflects a "relation" between x and y, for example in row > 4: 10% of the observations in x account for 10% of the observations in y. > > I feel embarrassed, but my mind went blank, and I can't think of a proper > way of visualizing this "relation" based on the data above (nor of the > appropriate terminology to phrase my question other than "by example"). > > My apologies and thanks for your hints! > > //stefan > > ______________________________**________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/**listinfo/r-help<https://stat.ethz.ch/mailman/listinfo/r-help> > PLEASE do read the posting guide http://www.R-project.org/** > posting-guide.html <http://www.R-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. >[[alternative HTML version deleted]]
Stefan Sobernig
2012-Nov-13 18:56 UTC
[R] How to visualize relation between two sets of rel. frequencies?
Rich, > I see at as an application of> a Likert plot. I would start with thisIndeed, I went with an HH likert() for now. I am not so sure about the scaling, though. So for now, I stick with counts ... but I will revisit that with a fresh mind tomorrow. Many thanks for your suggestion! //stefan