18
$\begingroup$

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).

$\endgroup$
5
  • $\begingroup$ 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. $\endgroup$
    – Peter Flom
    Commented Oct 1, 2012 at 10:54
  • 2
    $\begingroup$ 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). $\endgroup$
    – Andy W
    Commented Oct 1, 2012 at 12:02
  • $\begingroup$ 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). $\endgroup$ Commented Oct 1, 2012 at 13:49
  • $\begingroup$ "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." Good point. It is indeed counter-intuitive. The light spectrum goes roughly from blue on the left (associated with smaller wavelengths) to red on the right (associated with bigger wavelengths). Mosaic displays seem to reverse this on its head... $\endgroup$
    – landroni
    Commented Jun 21, 2015 at 20:17
  • $\begingroup$ The idea of the sieve diagram is that the number of boxes in each cell is proportional to observed frequency, so relative density shows greater or less than expected frequency. If you don't like the colors, you can easily change them from the defaults. If you don't like the default sieve shading function, you can easily write your own, e.g., shading.points() to do what you want, within the strucplot framework that was cited above and is available as a vignette in the vcd package. $\endgroup$
    – user101089
    Commented Feb 10, 2016 at 21:43

2 Answers 2

17
+50
$\begingroup$

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

$\endgroup$
1
  • 2
    $\begingroup$ 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. $\endgroup$
    – Andy W
    Commented Oct 8, 2012 at 15:18
1
$\begingroup$

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.)

$\endgroup$
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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