Take the 2-minute tour ×
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

I once stumbled across a type of plot for categorical data (i.e., contingency tables) on the internet, which I really liked, but I've never found it again, and I don't even know what it's called. It was essentially like a sieve plot, in that the row heights and column widths were scaled relative to the marginal probabilities. Thus, each box was scaled to the relative frequency expected under independence. However, it differed from a sieve plot in that, rather than plotting cross-hatching within each box, it plotted a point (like in a scatterplot) at a location randomly chosen from a bivariate uniform for each observation. In this way, the density of the points reflects how well the observed counts match the expected counts. That is, if the density were similar in every box, the null model is reasonable, but if there is a box with very low, or very high density, that conjunction of categories ($i,j$) might not be very likely under the null model. Because points are plotted instead of cross-hatching, there is a simple and intuitive correspondence between the plotted element and the observed count, which is not necessarily true for sieve plots (see below). Moreover, the random placement of the points gives the plot an 'organic' feel. In addition, color could be used to highlight boxes / cells that strongly diverge from the null model, and a plot matrix could be used to examine pairwise relationships between many different variables, so it can incorporate the advantages of similar plots.

  • Does anyone know what this plot is called?
  • Is there a package / function that will do this easily in R, or other software (say, Mondrian)? I can't find anything like it in vcd. Of course, it could be hard coded from scratch, but that would be a pain.

Here is a simple example of a sieve plot, notice that it's easy to see how the expected counts for the different categories should play out under the null model, but hard to reconcile the cross-hatching with the actual numbers, yielding a plot that's not quite as easy to read and aesthetically hideous:

    B ~B
 A 38  4
~A  3 19

enter image description here
For what it's worth, a mosaic plot has sort of the opposite problem: although it's easier to see which cells have 'too many' or 'too few' counts (relative to the null model), it's harder to recognize what the relationships between the expected counts would have been. Specifically, column widths are scaled relative to the marginal probability, but the row heights are not, making that piece of information nearly impossible to extract.
enter image description here
and now for something completely different...

  • Does anyone know where the convention to use blue for 'too many' and red for 'too few' comes from? This has always been counterintuitive for me. It seems to me that exceptionally high density (or too many observations) goes with hot, and low density goes with cold, and that (at least in stage lighting) reds are warms and blues are cools.

Update: If I remember correctly, the plot I saw was in a pdf of a chapter (introduction or ch1) from a book that was made freely available online as a marketing teaser. Here is a rough version of the idea that I coded from scratch:
enter image description here
Even with this crude version, I think it's easier to read than the sieve plot, and in some ways easier than the mosaic plot (e.g., it's easier to recognize what the relationships between the cell frequencies would be under independence). It would be nice to have a function that: a. would do this automatically with any contingency table, b. could be used as a building block of a plot matrix, and c. would have the nice features that come with the above plots (like the standardized residuals legend on the mosaic plot).

share|improve this question
    
So, you essentially want a mosaic plot with a different sort of fill? Does the R function assocplot come close to what you mean? If not, I bet an R programmer could modify either that or mosaicplot to do what you want. –  Peter Flom Oct 1 '12 at 10:54
1  
Related references of interest, Residual-based Shadings for Visualizing (Conditional) Independence (Zeileis et al. 2007), PDF here, and another thread here on visualizing contingency tables with a few references. I believe the Zeileis article has a nice discussion on color that may answer your last question (it may be good to peruse the references to see if they cite the chart you are talking about as well). –  Andy W Oct 1 '12 at 12:02
    
It's the opposite, @PeterFlom, I want essentially a sieve plot with a different sort of fill. Alternatively, you could say I want a mosaic plot where the boxes displayed are scaled relative to the expected frequencies under independence (& possibly a different type of fill as well). –  gung Oct 1 '12 at 13:49

2 Answers 2

up vote 11 down vote accepted
+50

The book you described sounds like, 'Visualizing Categorical Data,' Michael Friendly. The plot described in the 1st chapter that seems to match your request was described as a type of conceptual model for visualizing contingency table data (loosely described by the author as a dynamic pressure model with observational density), and can be seen in the google preview for Ch 1. The book is geared towards SAS users.

A paper on the topic is referenced here: www.datavis.ca/papers/koln/kolnpapr.pdf

'Conceptual Models for Visualizing Contingency Table Data,' Michael Friendly .

http://i47.tinypic.com/148n5n7.jpg

enter image description here

*incidentally, the author is also listed as one of the authors of the vcd package (as it was specifically inspired by his book mentioned above) -- maybe you could ask him directly if there's a simple modification to one of the built in functions that's not readily apparent.

** The coloring scheme seems to relate the color blue with positive deviations from independence, and red for negative deviations. Although the red scheme makes sense in that context, maybe it would have been more apt to have used green to represent positive deviations.

http://www.datavis.ca/papers/asa92.html

share|improve this answer
2  
Nice work the mystery is solved! I need to actually buy the book instead of previewing it in various tid-bits and having my library send me chapters every now and then. IMO this form of visualization reminds me alot of what cartographers call "dot maps", and one could utilize literature from there to justify how dots are a better visualization tool than the lines and cross-hatchings. It is also a good literature in terms of preferential placements of the dots. –  Andy W Oct 8 '12 at 15:18
    
This gives me a good start. Thanks for your help. –  gung Oct 16 '12 at 1:32

Maybe not what you saw, but for visualization of departures expected under independence correspondence plots are well motivated.

http://www.jstatsoft.org/v20/i03/

(An an aside, SAS and M Friendly's book were mistaken about the recommended adjustment and many of the plots had artifacts in them and this may have distracted from their perceived value.)

share|improve this answer
    
Thanks for your help, I like correspondence plots. Can you say more about this recommended adjustment that was mistaken? What adjustment was it? How was it inaccurate? And what was wrong with the plots? –  gung Oct 16 '12 at 1:35
1  

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.