Mar 28, 2016

Random graphs (67): Dot plots with confidence intervals

clear
input str20 cntry str30 outcome lb icc ub
"Finland"   "Attainment" .35 .36 .38
"Germany"   "Attainment" .43 .51 .60
"Norway"   "Attainment" .41 .41 .42
"Sweden"   "Attainment" .41 .41 .42
"United Kingdom" "Attainment" .34 .44 .54
"United States"  "Attainment" .49 .51 .53
"Finland"   "GPA"        .   .   .
"Germany"   "GPA"        .19 .23 .28
"Norway"   "GPA"        .48 .48 .48
"Sweden"   "GPA"        .52 .52 .52
"United Kingdom" "GPA"        .   .   .
"United States"  "GPA"        .37 .41 .46
"Finland"   "Cognitive skills"  .   .   .
"Germany"   "Cognitive skills"  .39 .46 .52
"Norway"   "Cognitive skills"  .   .   .
"Sweden"   "Cognitive skills"  .50 .50 .51
"United Kingdom" "Cognitive skills"  .   .   .
"United States"  "Cognitive skills"  .55 .57 .60
end

// Defining the label first allows to determine order of -encode- categories
label define country 1 "Finland" 2 "Germany" 3 "Norway" 4 "Sweden" ///
                     5 "United Kingdom" 6 "United States"
encode cntry, gen(country) label(country)

twoway (rcap icc icc country, by(outcome, note("") row(1) legend(off)) horizontal) ///
       (rspike ub lb country, by(outcome) horizontal) ///
      , ylabel(1/6, val)  ytitle("") xscale(alt) yscale(reverse)