Soci 109: Sample graph commands

Lane Kenworthy
Soci 109: Analysis of Sociological Data
Winter 2020

Scatterplots

DOES THE ECONOMY INFLUENCE PRESIDENTIAL ELECTION OUTCOMES?

Figure 20. Income growth and presidential election outcomes
Vertical axis: incumbent-party candidate’s popular vote margin. Data source: Wikipedia. Horizontal axis: growth rate of real disposable personal income per capita in the second and third quarters of the election year, adjusted for incumbency (-1.29 for each consecutive term, beyond the first, that the incumbent party has held the White House). Data source: Bureau of Economic Analysis, bea.gov, using National Income and Product Accounts (NIPA) data. The correlation is .91. This replicates and extends Larry Bartels’ chart in “Obama Toes the Line,” The Monkey Cage, 2013. For more detail, see Christopher Achen and Larry Bartels, Democracy for Realists, Princeton University Press, 2016, ch. 6.

Data set: LINK

Stata commands: scatter incumbentpartyvotemargin tenureadjustedincomegrowth, msymbol(i) mlabel(year) mlabposition(0) mlabsize(*1) || lfit incumbentpartyvotemargin tenureadjustedincomegrowth, connect(direct) clpattern(solid) clwidth(*1.5) clcolor(black) || , scale(1.425) ysize(2.5) xsize(4) ytitle("Incumbent party vote margin", margin(0 0 0 0)) xtitle("Tenure-adjusted income growth", margin(0 0 0 2)) ylabel(-10 "-10 " 0 "0 " 20 "20%", angle(horizontal)) xlabel(-3 0 3 "3%") yline(0, lwidth(thin)) plotregion(style(none)) graphregion(margin(l+11 r+32)) legend(off)

EARNINGS BY EDUCATION ACROSS INDIVIDUALS IN THE US

Figure 2. Earnings by education across individuals in the US
Median earnings, 2016. Persons age 25 and over. Weekly earnings multiplied by 50. “k” = thousand. “13-15” = some college, no degree. “As” = Associate’s degree. “BA” = bachelor’s degree. “MA” = Master’s degree. “Prof” = professional degree. “PhD” = doctoral degree. Data source: Bureau of Labor Statistics, “Earnings and Unemployment Rates by Educational Attainment,” using Current Population Survey data.

Data set: LINK

Stata commands: scatter earnings_median_annual_2016 educationgroup, msymbol(circle) msize(*1.4) mcolor(black) connect(none) || , scale(1.425) ysize(2.5) xsize(4) ytitle("Individual earnings", margin(0 0 0 0)) xtitle("Education: schooling completed", margin(0 0 0 2)) ylabel(0 "0 " 25000 "25 " 87000 "$87k", angle(horizontal)) xlabel(1 "0-11" 2 "12" 3 "13-15" 4 "As" 5 "BA" 6 "MA" 7 "Prof" 8 "PhD") plotregion(style(none)) graphregion(margin(l+10 r+32)) legend(off)

LIFE EXPECTANCY BY EDUCATION ACROSS COUNTRIES

Figure 9. Life expectancy by education across countries
Life expectancy: years of life expectancy at birth, 2014. Data source: OECD. Education: average literacy and numeracy score on the OECD’s Survey of Adult Skills, 2013. Data source: OECD, Skills Outlook, 2013, tables A2.2a and A2.6a. The line is a linear regression line.

Data set: LINK

Stata commands: scatter lifeexpectancy_2014 literacy_overallmean_2013, mlabel(countryabbr) mlabposition(0) mlabsize(*1.25) msymbol(i) connect(none) || lfit lifeexpectancy_2014 literacy_overallmean_2013, connect(direct) clpattern(solid) clwidth(thick) clcolor(black) || , scale(1.425) ysize(2.5) xsize(4) ytitle("Life expectancy", margin(0 0 0 0)) xtitle("Education: adult literacy", margin(0 0 0 2)) ylabel(78 84, angle(horizontal)) xlabel(245 295) plotregion(style(none)) graphregion(margin(l+15 r+32)) legend(off)