Publications by Anthony B. Masters
GE 2017 Majorities
Purpose This R Markdown document shows the code for calculations and graphs about the 2017 General Election. Electoral data is drawn from the House of Commons Library CBP-7979. Packages and Themes First, I install the tidyverse package. library(tidyverse) Next, I set the graphical theme: theme_clean <- theme_bw(base_family="Calibri") + theme(...
921 sym R (7284 sym/20 pcs) 5 img
Doubling Times
R Markdown This is an R Markdown document, showing doubling times for COVID-19 confirmed deaths. The graph shows the doubling time for select countries. Packages and Themes First, we install the packages we need. library(tidyverse) library(naniar) Next, I set the graph theme. theme_clean <- theme_bw(base_family="Calibri") + theme(legend.posit...
849 sym R (2539 sym/8 pcs) 1 img
False Positives and False Negatives
Purpose This R Markdown document shows three illustrative examples of false positive and false negative rates. The aim is to show how those rates and disease prevalence affects average test results. This document will use the ‘waffle’ package to create the graphs. Install packages First, we install the packages we need: library(tidyverse) in...
754 sym R (2879 sym/17 pcs) 3 img
Parallel Tests
R Markdown This is an R Markdown document, showing differences in p-value calculations under different modelling assumptions. Install package and set theme First, we install the packages we need: library(tidyverse) Next, I set the theme: theme_clean <- theme_bw(base_family="Calibri") + theme(legend.position = "top", legend.title = ele...
833 sym R (2161 sym/5 pcs) 1 img
BARB Weekly Viewing
R Markdown This is an R Markdown document, showing measures of BBC estimated viewers across four different channels. This is estimated using the BARB household panel weekly data. Install Packages First, we install the packages we need: library(tidyverse) library(readxl) library(lubridate) library(scales) Set the theme Next, we set the theme. th...
607 sym R (2167 sym/7 pcs) 2 img
GE Vote Share Changes
Purpose This document contains the code for static and animated graphs, showing the progression of declared vote share changes on election night. Install packages First, we install the packages we are going to use: library(tidyverse) library(readxl) library(gganimate) library(gifski) library(png) Set the theme and colours Next, we set the theme...
939 sym R (4064 sym/9 pcs) 2 img
A Degree of Extrapolation
Purpose This document provides the code for the graphs and forecast included in the article ‘A Degree of Extrapolation’. We look at HESA statistics on qualifications achieved by first-degree graduates. The data may be downloaded from a Google Sheet. Packages and Themes First, we download the required packages and set the theme. library(tidyv...
1626 sym R (7125 sym/23 pcs) 5 img
UK Vote Shares (1918 - 2019)
Purpose This graph will show UK vote shares in every General Election since 1918. It is based on two House of Commons Library briefing papers, CBP-7259 and CBP-8749. Packages and Themes First, we install the tidyverse and readxl packages. library(tidyverse) library(readxl) Next, we set the themes and colours. theme_clean <- theme_bw(base_family=...
567 sym R (2096 sym/9 pcs) 1 img
Exit Poll Performance (2001 - 2019)
R Markdown This docuemnt shows how to create a graph showing broadcaster exit poll performance from 2001 to 2019. Packages and Themes First, we install the tidyverse and readxl packages. library(tidyverse) library(readxl) Next, we set the theme and party colours. theme_clean <- theme_bw(base_family="Calibri") + theme(legend.position = "top", ...
374 sym R (1562 sym/5 pcs) 1 img
Illustrating the Ecological Fallacy
R Markdown The purpose of this code to create graphs, demonstrating the ecological fallacy with an illustrative election. Package and Themes First, we install the tidyverse package. library(tidyverse) Next, we create our custom theme. theme_clean <- theme_bw(base_family="Calibri") + theme(legend.position = "top", legend.title = elemen...
433 sym R (2744 sym/8 pcs) 2 img