cluelessresearch.com

political methodology, brazilian politics, etc.

From tables to graphs

I embarked on a paper project with John Kastellec to document the use of statistical tables versus graphs in political science and provide examples about how many (even most) of the tables can be transformed into graphs. That is, we aim to do for a political science audience what Andrew Gelman and coauthors did for statistics.

The main reason we use tables is because, well, they are a hundred times (or more) easier to produce. In that respect, our plan is to provide code showing how we did the examples and also provide functions that transforms what we identified as most frequent kinds of tables into (hopefully beautiful) graphs. We aim, therefore, to make it easy the translation from tables to graphs.

For the time being, the code and examples will be hosted here at brazilianpolitics.org. My first contribution is a function that takes a matrix correlations and produces a image plot like the figure 8 in Zhengy, Salganikz and Gelman “How many people do you know in prison?: Using overdispersion in count data to estimate social structure in networks”, JASA 101(474): 409-423.

(links to code and graphs always point to the latest version, and are continually updated. use it at your own risk.)

A key ingredient of the plot is the reordering of the variables that maximizes the correlation between nearby groups. In the following plot I did not ask for reordering, and the graph is much less cleaner.

Source code.

Stay tuned for more examples.

Comments are closed.