Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Graphical challenge from Gelman blog


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Graphical challenge from Gelman blog
Date   Thu, 21 Apr 2011 16:26:53 +0100

Over at Andrew Gelman's blog, there have been various attempts to
improve on a graph first published by the The Economist. Most of the
solutions use R. Some Stata users may want to try to see what they can
do. Here are the threads:

http://www.stat.columbia.edu/~cook/movabletype/archives/2011/04/one_more_time-u.html

http://www.stat.columbia.edu/~cook/movabletype/archives/2011/04/attractive_but.html

http://www.stat.columbia.edu/~cook/movabletype/archives/2011/04/the_r_code_for.html

Here's some code to read the data into Stata. The data are average
hours per day spent in various activities in different countries.

clear
input hours
      4.2
      3.2
     11.1
      1.3
      2.2
        2
      3.9
      3.2
       10
       .8
      3.1
      3.1
      6.3
      2.5
      9.8
       .9
      2.2
      2.4
      4.4
      3.1
      9.8
       .8
      3.3
      2.7
      4.8
        3
      9.9
       .7
      3.1
      2.4
        4
      3.4
     10.5
       .7
      3.3
      2.1
end
egen country = seq(), block(6)
egen activity = seq(), to(6)
label def country 1 France 2 Germany 3 Japan 4 Britain 5 USA 6 Turkey
label def activity 1 Paid 2 Unpaid 3 "Eating, sleeping" 4 "Personal
care" 5 Leisure 6 Other
label val country country
label val activity activity

and here's one suggestion on how to plot it. I can see the force of
Andrew Gelman's suggestion to average across countries and plot
residuals from that, but plotting the original data works as well for
me.

tabplot ac co  [iw=hours], showval height(0.6) ytitle("") xtitle("")
subtitle(hours/day)

Here -tabplot- is from SSC. (By the way, versions of -tabplot- not yet
realised handle negative bars better than that on SSC, but there are
no negative bars in the above.)

Nick
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index