########################################################################### ### Scatter Plot of OECD Educatin Spending ### Produced by Thomas J. Pfaff for sustainabilitymath.org ### Sep 2018 ########################################################################### ## Read data from csv file. Ed.Spending=read.table("OECD-Education-Spending-20180913.csv", header=TRUE, sep=",") names(Ed.Spending) ## Creaete Graph par(bg = "#b3c0d7") title="Primary, secondary eduation, and post-secondary non-tertiary education spending (2015)\nOECD Countries plus Russia and Brazil\n with regression line" x.name="Percent of GDP" y.name="Per Student as a share of GDP per capita" plot(Ed.Spending$K12.PercentGDP,Ed.Spending$K12.PerStudentPerCapGDP,pch=16,cex=1.5,xlim=c(2,5),main=title, xlab=x.name, ylab=y.name) v=c(1,4:10,13:26,28:32,34:35) v.c=c(2:3,11:12,27,33) text(Ed.Spending$K12.PercentGDP[v],Ed.Spending$K12.PerStudentPerCapGDP[v],labels=Ed.Spending$Country[v],pos=4,cex=0.75) text(Ed.Spending$K12.PercentGDP[v.c],Ed.Spending$K12.PerStudentPerCapGDP[v.c],labels=Ed.Spending$Country[v.c],pos=2,cex=0.75) mtext("Data from OECD", side=1, line=3, cex=0.8, adj=0) mtext("Produced by sustainabilitymath.org", side=1, line=4, cex=0.8, adj=0) ## Add Regrssion Line line=lm(Ed.Spending$K12.PerStudentPerCapGDP~Ed.Spending$K12.PercentGDP) abline(line,lwd=2,col="red") summary(line)