Original sources:
http://www.scottish.parliament.uk/ResearchBriefingsAndFactsheets/S4/SB_14-48.pdf
http://www.bbc.co.uk/news/events/scotland-decides/results
http://en.wikipedia.org/wiki/Scottish_independence_referendum,_2014
Load libraries and data (full data at end of document):
library(ggplot2)
refres <- read.table("ScotlandIncomeReferendum.txt", sep = "\t", header = T)
head(refres)
## Financial.Region Electorate Valid.Ballots Yes Disp.Income PC.Yes PC.No Turnout
## 1 Aberdeen City & Aberdeenshire 382231 323427 130727 18984 0.4042 0.5958 0.8462
## 2 Angus & Dundee City 212280 173736 88664 14955 0.5103 0.4897 0.8184
## 3 Argyll & Bute 72002 63467 26324 15845 0.4148 0.5852 0.8815
## 4 Clackmannanshire & Fife 342137 289322 130498 15115 0.4510 0.5490 0.8456
## 5 Comhairle nan Eilean Siar 22908 19739 9195 14541 0.4658 0.5342 0.8617
## 6 Dumfries & Galloway 122036 106653 36614 15525 0.3433 0.6567 0.8739
Weighted linear regression of Proportion of No Vote vs. Disposable Income (£)
fit1 <- lm(refres$PC.No ~ refres$Disp.Income, weights = refres$Valid.Ballots)
summary(fit1)
##
## Call:
## lm(formula = refres$PC.No ~ refres$Disp.Income, weights = refres$Valid.Ballots)
##
## Weighted Residuals:
## Min 1Q Median 3Q Max
## -22.85 -6.56 2.47 7.82 39.69
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.69e-01 7.26e-02 2.32 0.03 *
## refres$Disp.Income 2.36e-05 4.44e-06 5.32 2.8e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 14 on 21 degrees of freedom
## Multiple R-squared: 0.574, Adjusted R-squared: 0.554
## F-statistic: 28.3 on 1 and 21 DF, p-value: 2.8e-05
Plot the results with weighted regression using ggplot2:
ggplot(refres, aes(Disp.Income, PC.No)) +
stat_smooth(method = "lm", aes(weight=Valid.Ballots/1000), alpha = 0.1) +
geom_point(aes(size = Valid.Ballots/1000)) +
geom_text(aes(label = Financial.Region), vjust=-0.8, size = 4) +
labs(y = "Proportion of No Vote", x = "Disposable Income per head (£)", size = "Total Votes Cast (1000s)") +
theme_bw() +
theme(axis.text.x = element_text (size = 16, vjust = 0),
axis.text.y = element_text (size = 14, hjust = 1.3),
strip.text.x = element_text (size = 16, vjust = 0.7),
axis.title.y = element_text (size = 16, angle = 90, vjust = 0.8),
axis.title.x = element_text (size = 16, vjust = 0.2)) +
coord_cartesian(xlim = c(13000, 20000), ylim = c(0.4, 0.7))
Full data used in analysis:
refres
## Financial.Region Electorate Valid.Ballots Yes Disp.Income PC.Yes PC.No Turnout
## 1 Aberdeen City & Aberdeenshire 382231 323427 130727 18984 0.4042 0.5958 0.8462
## 2 Angus & Dundee City 212280 173736 88664 14955 0.5103 0.4897 0.8184
## 3 Argyll & Bute 72002 63467 26324 15845 0.4148 0.5852 0.8815
## 4 Clackmannanshire & Fife 342137 289322 130498 15115 0.4510 0.5490 0.8456
## 5 Comhairle nan Eilean Siar 22908 19739 9195 14541 0.4658 0.5342 0.8617
## 6 Dumfries & Galloway 122036 106653 36614 15525 0.3433 0.6567 0.8739
## 7 East & North Ayrshire 213587 180292 86834 14684 0.4816 0.5184 0.8441
## 8 East & West Dunbartonshire 157945 141334 64344 17139 0.4553 0.5447 0.8948
## 9 East Lothian & Midlothian 151562 132092 53837 17823 0.4076 0.5924 0.8715
## 10 Edinburgh 378012 318565 123927 19107 0.3890 0.6110 0.8427
## 11 Falkirk 122457 108519 50489 15190 0.4653 0.5347 0.8862
## 12 Glasgow City 486219 364126 194779 14161 0.5349 0.4651 0.7489
## 13 Highland 190778 165808 78069 16012 0.4708 0.5292 0.8691
## 14 Inverclyde & Renfrewshire 270197 238082 106996 16699 0.4494 0.5506 0.8811
## 15 Moray 75170 64167 27232 15947 0.4244 0.5756 0.8536
## 16 North Lanarkshire 268704 226705 115783 14282 0.5107 0.4893 0.8437
## 17 Orkney Islands 17806 14887 4883 17950 0.3280 0.6720 0.8361
## 18 Perth & Kinross & Stirling 189048 166352 66485 17835 0.3997 0.6003 0.8799
## 19 Scottish Borders 95533 83459 27906 16748 0.3344 0.6656 0.8736
## 20 Shetland Islands 18516 15620 5669 17882 0.3629 0.6371 0.8436
## 21 South Ayrshire 94881 81649 34402 16868 0.4213 0.5787 0.8605
## 22 South Lanarkshire 261157 222790 100990 15991 0.4533 0.5467 0.8531
## 23 West Lothian 138226 119024 53342 15258 0.4482 0.5518 0.8611