Note: for those interested, the adjusted R^2 here is 0.49 and the R code is below (R is amazing, by the way):
unemployment_by_country <- c(8.3, 9.8, 23, 14.1, 5.6, 9.3, 4.9, 7.2, 7.9, 7.4, 3.3, 18.9, 15, 7.6, 4.3) #as of nov 2011, from the Guardian
names <- c("United Kingdom", "France", "Spain", "Portugal", "", "Italy", "Netherlands", "Belgium","", "", "", "Greece", "Ireland", "", "")
taxes_percent_gdp <- c(36.1, 43.9, 31.4, 33.2, 38.7, 42.5, 38.4, 44.1, 47.7, 44.3, 42.5, 32.4, 28.9, 43.4, 42.0) # in 2011, from eurostat
plot(taxes_percent_gdp, unemployment_by_country, main="European unemployment vs tax rate by country",ylab="Unemployment rate (%)",xlab="Taxes as % of GDP",pch=19)
fit <- lm(unemployment_by_country ~ taxes_percent_gdp)
lm(formula = unemployment_by_country ~ taxes_percent_gdp)
summary(fit)
abline(fit)
#Adjust labels
text(taxes_percent_gdp,unemployment_by_country,labels=names,cex=0.8, pos=1, col="red")
text(44.3,7.4,"Sweden",adj=c(0,-1),cex=0.8, col="red")
text(43.4,7.6,"Finland",adj=c(1.2,.5),cex=0.8, col="red")
text(42.0,4.3,"Austria",adj=c(0,-1),cex=0.8, col="red")
text(42.5,3.3,"Norway",adj=c(-.2,0),cex=0.8, col="red")
text(38.7,5.6,"Germany",adj=c(-.2,0),cex=0.8, col="red")
text(47.7,7.9,"Denmark",adj=c(.7,1),cex=0.8, col="red")
No comments:
Post a Comment