Another crosshairs
[This article was first published on A Distant ObserveR, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
C. DeSante over at is.R() has PEBOS as well, but turned it into a great explanation of the way predictions like Nate Silver’s work.
For a while the 538 team had PEBOS as well: “The FiveThirtyEight team is still recuperating, but the election provided a fresh supply of data points that we’ll be connecting in the coming days.”
This inspired me to add some predictions of the popular vote to my crosshairs plot. The data are from here.
We can see that Nate was closest. Well how does the old song sing?
Pass my window, pass my gate
Pass my window, pass my gate
You can pass my window, can pass my gate
But you’ll never pass FiveThirtyEight…The additional code is simple:
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
# numbers from http://news.cnet.com/8301-13578_3-57546778-38/among-the-top-election-quants-nate-silver-reigns-supreme/ | |
nate <- c(50.8, 48.3) | |
tpm <- c(48.8, 48.1) | |
rcp <- c(48.8, 48.1) | |
huff <- c(48.1, 46.7) | |
png('crosshairs2.png') | |
crosshairs(centre = centre, # the actual popular vote | |
pts = pts, # the predistions | |
no.rings = 4, # four rings seem about right here ("4 more years") | |
title = "Pollsters on target?", | |
x.ann = "Obama popular vote (%)", # annotation for x axis | |
y.ann = "Romney popularvote (%)" # annotation for y axis | |
) | |
points(nate[1], nate[2], col = "blue", pch = 22) | |
points(tpm[1], tpm[2], col = "black", pch = 22) | |
# as RCP and TPM actually have the same prediction, I'll use a different pch | |
points(rcp[1], rcp[2], col = "red", pch = 20) | |
points(huff[1], huff[2], col = "blue", pch = 22) | |
dev.off() |
To leave a comment for the author, please follow the link and comment on their blog: A Distant ObserveR.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.