This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(wbstats) | |
library(tidyverse) | |
library(ggplot2) | |
library(devtools) | |
install_github("Financial-Times/ftplottools") | |
library(ftplottools) | |
gdp_pc <- | |
wb_data( | |
indicator = c('SP.POP.TOTL', 'NY.GDP.PCAP.PP.KD', 'NY.GDP.PCAP.KD.ZG'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Calculating the expected return on a vote for the UK to | |
# remain a member of the European Union. | |
# v1.0 | |
# CC0 Andrew Steele (@statto) | |
# What are the odds of the election being won by your vote? | |
voters = 45e6 * 2/3 # 45 million voters, 2/3 turnout | |
diff( | |
pnorm( | |
voters/2 + 0:1, # victory by one vote |