This is a quick look at the data presented by Nathaniel Rakich on his blog post on 538.com: Special Elections Foreshadowed A Blue Wave In 2018. What Are They Saying Now?. In his post Nathaniel loks at the overall swing, and concludes
Taking everything into account, 2020 looks a little better for Democrats than for Republicans right now, but we probably shouldn’t read too much into so little data.
But I think the data is saying more than that. Let’s take a look.
First, we have to read in the data, and then do a bit of formatting.
library(XML)
library(RCurl)
## Loading required package: bitops
theurl <- getURL("https://fivethirtyeight.com/features/special-elections-foreshadowed-a-blue-wave-in-2018-what-are-they-saying-now/",
.opts = list(ssl.verifypeer = FALSE) ) # from http://tinyurl.com/yy5kja4m
Tab <- readHTMLTable(doc=theurl, stringsAsFactors = FALSE, header=TRUE)[[1]]
Tab <- Tab[Tab$Date!="Average",]
# convert lean to a number
ConvertLean <- function(str) {
Leans <- strsplit(str, "\\+")
Lean <- lapply(Leans, function(st) {as.numeric(st[2]) * (2*(st[1]=="R") - 1) })
unlist(Lean)
}
Tab[,c("Partisan Lean", "Special Margin", "Margin Swing")] <- apply(Tab[,c("Partisan Lean", "Special Margin", "Margin Swing")], 2, ConvertLean)
# make a variable with just the seat name, and npt the state
Tab$Seat2 <- gsub(".* ", "", Tab$Seat)
Tab$Seat2 <- gsub("\\*", "", Tab$Seat2)
And now to plot it
plot(Tab$`Partisan Lean`, Tab$`Special Margin`, type="n",
xlab="Partisan Lean (positive=Republican)",
ylab="Margin (positive=Republican win)")
text(Tab$`Partisan Lean`, Tab$`Special Margin`, Tab$Seat2, col="blue")
abline(0,1)
abline(v=0, lty=3)
abline(h=0, lty=3)
What do we see? Mostly, I think there is increased polarisation: many of the points fall on a line steeper than 1:1. But there are exceptiopns, atricularly in Republican leaning districts. There there are several seats where the margin is less than the lean. This contrasts with the Democrat-leaning seats where only SD-06 moves away from them (albeit by a large margin). This suggest to me that there is a combination of increased polarisation and a shift to the Democrats. It would also suggest that the news is better for the Democrats than Nathaniel Rakich suggests: they are making gains in Republican-leaning seats, whereas the Republicans are not gaining in Democrat seats.
Of course, this might change as time and more data accumulate, and a deeper analysis of polling might give a better suggestion for what is happening.