Sep 1, 2014

Random graphs (30): Log-log histograms

Healy and Moody (2014) recommend log-log histograms as an alternative to regular histograms. Given the fact that important variables in Sociology are often highly skewed, log-log histograms reveal greater details at the upper end of the distribution



// Membership variables of the first round (2002) of the ESS
use sptcmmb cltommb trummb prfommb ///
    cnsommb hmnommb epaommb rlgommb ///
    prtymmb setommb sclcmmb othvmmb using "ESS1e06.3_F1.dta", clear

// Generate count variable of memberships
scores memberships = total(sptcmmb cltommb trummb prfommb ///
                           cnsommb hmnommb epaommb rlgommb ///
                                 prtymmb setommb sclcmmb othvmmb)
                           
// Standard histogram
twoway (histogram memberships, percent     discrete), ///
        xtitle("Total no. of memberships in" "voluntary associations in last 12 mo.") ///
          ytitle("Respondents in ESS round 1 (%)") xlabel(0/12) name(a, replace)
         
// Log-log histogram
twoway__histogram_gen memberships, gen(y x) width(1) fraction
replace y = y * 100 // Convert fractions to %

scatter y x, yscale(log) xscale(log) ///
        xtitle("Total no. of memberships in" "voluntary associations in last 12 mo.") ///
        ytitle("Respondents in ESS round 1 (%)") xlabel(0/12) ///
  ylab(.1 1 10 20 40) ///
  name(b, replace)

graph combine a b    


Reference 

Healy, Kieran, and James Moody. 2014. "Data Visualization in Sociology." Annual Review of Sociology 40:105-128. doi: 10.1146/annurev-soc-071312-145551